Modifications associated with remerging the Ba/Sa and Dubna pixel simulations,
authornilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Jun 2004 21:00:25 +0000 (21:00 +0000)
committernilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Jun 2004 21:00:25 +0000 (21:00 +0000)
some cleaning of general code (including coding convensions), and adding some
protections associated with SetDefaults/SetDefaultSimulations which should help
with the Test beam simulations. Details below. The default SPD simulation for
the general ITS runs/geometry is still the Ba/Sa, but for the Test beam
geometries this has been changed to the merged versions.
File: AliITS.cxx                         Modified
File: AliITS.h                           Modified
      In lined many one-two line functions. Added some protection to
      SetDefaults(), SetDefaultSimulation(), and SetDefaultClusterFinders(),
      such that they should now even work when only one detector type has
      been defined (as it should be for the test beams...). Some mostly
      cosmetic issues associated with getting branch names for digits. And
      Generally some cleaning up of the code.
File: AliITSClusterFinder.cxx            Modified
File: AliITSClusterFinder.h              Modified
      Did some additional consolidation of data into the base class, added
      TClonesArray *fClusters, a fDebug, and fModule variables. Otherwise
      some cosmetic and coding conversion changes.
File: AliITSClusterFinderSDD.cxx         Modified
File: AliITSClusterFinderSDD.h           Modified
      Changes to be consistent with the modified base class, and cosmetic
      and coding conversion changes.
File: AliITSClusterFinderSPD.cxx         Modified
File: AliITSClusterFinderSPD.h           Modified
      Changes to be consistent with the modified base class, and cosmetic
      and coding conversion changes.
File: AliITSClusterFinderSPDdubna.h       Removed
File: AliITSClusterFinderSPDdubna.cxx     Removed
      Since we have ClusterFinderSPD and V2 and this version isn't being
      maintained, it is being retired.
File: AliITSClusterFinderSSD.cxx         Modified
File: AliITSClusterFinderSSD.h           Modified
      Changes to be consistent with the modified base class, and cosmetic
      and coding conversion changes.
File: AliITSDetType.cxx                  Modified
File: AliITSDetType.h                    Modified
      Added a new class variable to indicate what the detector type is
      AliITSDetector fDetType;  values of kSPD, kSDD, kSSD, .... Otherwise
      cosmetic and Coding convention changes.
File: AliITSLoader.cxx                   Modified
File: AliITSLoader.h                     Modified
      Some changes which are not complete. The idea is to be able to get,
      simply via one call, a specific hit, Sdigit, digit, RecPoint,...
      without all of the usual over head of initializing TClonesArrays setting
      branch addresses and the like. Work is far form ready.
File: AliITSdcsSSD.cxx                   Modified
      Some nearly cosmetic changes necessary due to changes to response and
      segmentation class'.
File: AliITSgeom.h                       Modified
      In the definition of AliITSDetector type, added kND=-1, no detector
      defined. Expect to use it later(?).
File: AliITSresponse.h                   Modified
      Basically cosmetic. Mostly changing Float_t to Double_t.
File: AliITSresponseSDD.cxx              Modified
File: AliITSresponseSDD.h                Modified
      Basically the cosmetic and Float_t to Double_t
File: AliITSresponseSPD.cxx              Modified
File: AliITSresponseSPD.h                Modified
      Mostly Float_t to Double_t and added in the IsPixelDead function for
      the dubna version (otherwise the merging had been done).
File: AliITSresponseSPDdubna.h           Removed
File: AliITSresponseSPDdubna.cxx         Removed
      We should be able to remove this class now. AliITSresponseSPD is now
      used for both the Bari-Salerno and the dubna models.
File: AliITSresponseSSD.cxx              Modified
File: AliITSresponseSSD.h                Modified
      Float_t to Double_t changes.
File: AliITSsegmentation.h               Modified
      Made LocaltoDet return a Bool_t. Now if the x,z location is outside
      of the volume, it returns kFALSE. see below.
File: AliITSsegmentationSDD.cxx          Modified
File: AliITSsegmentationSDD.h            Modified
      Made LocaltoDet return a Bool_t. Now if the x,z location is outside
      of the volume, it returns kFALSE.
File: AliITSsegmentationSPD.cxx          Modified
File: AliITSsegmentationSPD.h            Modified
      Made LocaltoDet return a Bool_t. Now if the x,z location is outside
      of the volume, it returns kFALSE.
File: AliITSsegmentationSSD.cxx          Modified
File: AliITSsegmentationSSD.h            Modified
      Made LocaltoDet return a Bool_t. Now if the x,z location is outside
      of the volume, it returns kFALSE. see below.
File: AliITSsimulation.cxx               Modified
File: AliITSsimulation.h                 Modified
      Added fDebug variable, new Constructor for use below. Cosmetic and
      coding convention changes
File: AliITSsimulationSDD.cxx            Modified
File: AliITSsimulationSDD.h              Modified
      Added new Constructor, removed redundant variables and Cosmetic and
      coding convention changes.
File: AliITSsimulationSPD.cxx            Modified
File: AliITSsimulationSPD.h              Modified
      Removed some dead code, made changes as needed by the changes above
      (response and segmentation classes...). a few cosmetic and coding
      convention changes.
File: AliITSsimulationSPDdubna.cxx       Modified
File: AliITSsimulationSPDdubna.h         Modified
      New merged version, implemented new and old coupling with switch,
      coding convention and similar changes. (found 1 bugs, missing
      ! in front of if(mod-LineSegmentL(....,).
File: AliITSsimulationSSD.cxx            Modified
File: AliITSsimulationSSD.h              Modified
      removed redundant variables with base class. Fixed for coding
      convention and other cosmetic changes.
File: AliITSvSDD03.cxx                   Modified
File: AliITSvSPD02.cxx                   Modified
File: AliITSvSSD03.cxx                   Modified
      These two have their private versions of SetDefaults and
      SetDefaultSimulation which have been similarly protected as in AliITS.cxx
File: ITSLinkDef.h                       Modified
File: libITS.pkg                         Modified
      Versions which include v11 geometry and other private changes

49 files changed:
ITS/AliITS.cxx
ITS/AliITS.h
ITS/AliITSClusterFinder.cxx
ITS/AliITSClusterFinder.h
ITS/AliITSClusterFinderSDD.cxx
ITS/AliITSClusterFinderSDD.h
ITS/AliITSClusterFinderSPD.cxx
ITS/AliITSClusterFinderSPD.h
ITS/AliITSClusterFinderSPDdubna.cxx [deleted file]
ITS/AliITSClusterFinderSPDdubna.h [deleted file]
ITS/AliITSClusterFinderSSD.cxx
ITS/AliITSClusterFinderSSD.h
ITS/AliITSDetType.cxx
ITS/AliITSDetType.h
ITS/AliITSLoader.cxx
ITS/AliITSLoader.h
ITS/AliITSdcsSSD.cxx
ITS/AliITSgeom.h
ITS/AliITSresponse.h
ITS/AliITSresponseSDD.cxx
ITS/AliITSresponseSDD.h
ITS/AliITSresponseSPD.cxx
ITS/AliITSresponseSPD.h
ITS/AliITSresponseSPDdubna.cxx [deleted file]
ITS/AliITSresponseSPDdubna.h [deleted file]
ITS/AliITSresponseSSD.cxx
ITS/AliITSresponseSSD.h
ITS/AliITSsegmentation.h
ITS/AliITSsegmentationSDD.cxx
ITS/AliITSsegmentationSDD.h
ITS/AliITSsegmentationSPD.cxx
ITS/AliITSsegmentationSPD.h
ITS/AliITSsegmentationSSD.cxx
ITS/AliITSsegmentationSSD.h
ITS/AliITSsimulation.cxx
ITS/AliITSsimulation.h
ITS/AliITSsimulationSDD.cxx
ITS/AliITSsimulationSDD.h
ITS/AliITSsimulationSPD.cxx
ITS/AliITSsimulationSPD.h
ITS/AliITSsimulationSPDdubna.cxx
ITS/AliITSsimulationSPDdubna.h
ITS/AliITSsimulationSSD.cxx
ITS/AliITSsimulationSSD.h
ITS/AliITSvSDD03.cxx
ITS/AliITSvSPD02.cxx
ITS/AliITSvSSD03.cxx
ITS/ITSLinkDef.h
ITS/libITS.pkg

index a009385..b155d86 100644 (file)
@@ -196,7 +196,8 @@ 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
-    if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);// Not done in AliDetector.
+    // Not done in AliDetector.
+    if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);
 
     fEuclidOut  = 0;
     fITSgeom    = 0;
@@ -328,21 +329,18 @@ AliITS& AliITS::operator=(AliITS &source){
     return *this; //fake return
 }
 //______________________________________________________________________
-Int_t AliITS::DistancetoPrimitive(Int_t,Int_t) const{
-    // Distance from mouse to ITS on the screen. Dummy routine
-    //     A dummy routine used by the ROOT macro display.C to allow for the
-    // use of the mouse (pointing device) in the macro. In general this should
-    // never be called. If it is it returns the number 9999 for any value of
-    // x and y.
+AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager)const{
+    // Creates the AliITSDigitizer in a standard way for use via AliModule.
+    // This function can not be included in the .h file because of problems
+    // with the order of inclusion (recursive).
     // Inputs:
-    //      Int_t     Dummy screen coordinate.
-    //      Int_t     Dummy screen coordinate.
-    // Outputs:
-    //      none.
+    //    AliRunDigitizer *manager  The Manger class for Digitization
+    // Output:
+    //    none.
     // Return:
-    //      Int_t     Dummy = 9999 distance to ITS.
+    //    A new AliITSRunDigitizer (cast as a AliDigitizer).
 
-    return 9999;
+     return new AliITSDigitizer(manager);
 }
 //______________________________________________________________________
 void AliITS::Init(){
@@ -373,56 +371,64 @@ void AliITS::SetDefaults(){
     //      none.
     // Return:
     //      none.
-
-    if(fDebug) printf("%s: SetDefaults\n",ClassName());
-
+    AliITSsegmentation *seg;
+    AliITSresponse    *resp;
     AliITSDetType *iDetType;
 
+    if(fDebug) Info("SetDefauls","%s: SetDefaults",ClassName());
+
     //SPD
-    iDetType=DetType(0); 
-    if (!iDetType->GetSegmentationModel()) {
-        AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
-        SetSegmentationModel(0,seg0); 
-    } // end if
-    if (!iDetType->GetResponseModel()) {
-        SetResponseModel(0,new AliITSresponseSPD()); 
-    } // end if
-    // set digit and raw cluster classes to be used
+    iDetType = DetType(kSPD);
+    if(iDetType){
+        if (!iDetType->GetSegmentationModel()) {
+            seg = new AliITSsegmentationSPD(fITSgeom);
+            SetSegmentationModel(kSPD,seg); 
+        } // end if
+        if (!iDetType->GetResponseModel()) {
+            SetResponseModel(kSPD,new AliITSresponseSPD()); 
+        } // end if
+        // set digit and raw cluster classes to be used
 
-    const char *kData0=(iDetType->GetResponseModel())->DataType();
-    if (strstr(kData0,"real")) {
-        iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
-    } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
+        const char *kData0=(iDetType->GetResponseModel())->DataType();
+        if (strstr(kData0,"real")) {
+            iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD");
+        } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
+    } // end if iDetType
 
     // SDD
-    iDetType=DetType(1); 
-    if (!iDetType->GetResponseModel()) {
-        SetResponseModel(1,new AliITSresponseSDD("simulated")); 
-    } // end if
-    AliITSresponse *resp1=iDetType->GetResponseModel();
-    if (!iDetType->GetSegmentationModel()) {
-        AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
-        SetSegmentationModel(1,seg1); 
-    } // end if
-    const char *kData1=(iDetType->GetResponseModel())->DataType();
-    const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
-    if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){
-        iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
-    } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
+    iDetType = DetType(kSDD); 
+    if(iDetType){
+        if (!iDetType->GetResponseModel()) {
+            SetResponseModel(kSDD,new AliITSresponseSDD("simulated")); 
+        } // end if
+        resp = iDetType->GetResponseModel();
+        if (!iDetType->GetSegmentationModel()) {
+            seg = new AliITSsegmentationSDD(fITSgeom,resp);
+            SetSegmentationModel(kSDD,seg); 
+        } // end if
+        const char *kData1 = (iDetType->GetResponseModel())->DataType();
+        const char *kopt = iDetType->GetResponseModel()->ZeroSuppOption();
+        if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || 
+                                   strstr(kData1,"real") ){
+            iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
+        } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
+    } // end if iDetType
 
     // SSD
-    iDetType=DetType(2); 
-    if (!iDetType->GetSegmentationModel()) {
-        AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
-        SetSegmentationModel(2,seg2); 
-    } // end if
-    if (!iDetType->GetResponseModel()) {
-        SetResponseModel(2,new AliITSresponseSSD("simulated"));
-    } // end if
-    const char *kData2=(iDetType->GetResponseModel())->DataType();
-    if (strstr(kData2,"real")) {
-        iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
-    } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
+    iDetType = DetType(kSSD); 
+    if(iDetType){
+        if (!iDetType->GetSegmentationModel()) {
+            seg = new AliITSsegmentationSSD(fITSgeom);
+            SetSegmentationModel(kSSD,seg); 
+        } // end if
+        if (!iDetType->GetResponseModel()) {
+            SetResponseModel(kSSD,new AliITSresponseSSD("simulated"));
+        } // end if
+        const char *kData2 = (iDetType->GetResponseModel())->DataType();
+        if (strstr(kData2,"real")) {
+            iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD");
+        } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
+    } // end if iDetType
 
     if (kNTYPES>3) {
         Warning("SetDefaults",
@@ -438,60 +444,59 @@ void AliITS::SetDefaultSimulation(){
     //      none.
     // Return:
     //      none.
-
     AliITSDetType *iDetType;
     AliITSsimulation *sim;
-    iDetType=DetType(0);
-    sim = iDetType->GetSimulationModel();
-    if (!sim) {
-        AliITSsegmentation *seg0=
-            (AliITSsegmentation*)iDetType->GetSegmentationModel();
-        AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
-        AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
-        SetSimulationModel(0,sim0);
-    }else{ // simulation exists, make sure it is set up properly.
-        ((AliITSsimulationSPD*)sim)->Init(
-            (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
-            (AliITSresponseSPD*) iDetType->GetResponseModel());
-//        if(sim->GetResponseModel()==0) sim->SetResponseModel(
-//            (AliITSresponse*)iDetType->GetResponseModel());
-//        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
-//            (AliITSsegmentation*)iDetType->GetSegmentationModel());
-    } // end if
-    iDetType=DetType(1);
-    sim = iDetType->GetSimulationModel();
-    if (!sim) {
-        AliITSsegmentation *seg1=
-            (AliITSsegmentation*)iDetType->GetSegmentationModel();
-        AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
-        AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
-        SetSimulationModel(1,sim1);
-    }else{ // simulation exists, make sure it is set up properly.
-        ((AliITSsimulationSDD*)sim)->Init(
-            (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
-            (AliITSresponseSDD*) iDetType->GetResponseModel());
-//        if(sim->GetResponseModel()==0) sim->SetResponseModel(
-//            (AliITSresponse*)iDetType->GetResponseModel());
-//        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
-//            (AliITSsegmentation*)iDetType->GetSegmentationModel());
-    } //end if
-    iDetType=DetType(2);
-    sim = iDetType->GetSimulationModel();
-    if (!sim) {
-        AliITSsegmentation *seg2=
-            (AliITSsegmentation*)iDetType->GetSegmentationModel();
-        AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
-        AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
-        SetSimulationModel(2,sim2);
-    }else{ // simulation exists, make sure it is set up properly.
-        ((AliITSsimulationSSD*)sim)->Init(
-            (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),
-            (AliITSresponseSSD*) iDetType->GetResponseModel());
-//        if(sim->GetResponseModel()==0) sim->SetResponseModel(
-//            (AliITSresponse*)iDetType->GetResponseModel());
-//        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
-//            (AliITSsegmentation*)iDetType->GetSegmentationModel());
-    } // end if
+    AliITSsegmentation *seg;
+    AliITSresponse *res;
+
+    iDetType = DetType(kSPD);
+    if(iDetType){
+        sim = iDetType->GetSimulationModel();
+        if (!sim) {
+            seg = (AliITSsegmentation*)iDetType->GetSegmentationModel();
+            res = (AliITSresponse*)iDetType->GetResponseModel();
+            sim = new AliITSsimulationSPD(seg,res);
+            SetSimulationModel(kSPD,sim);
+        }else{ // simulation exists, make sure it is set up properly.
+            if(sim->GetResponseModel()==0) sim->SetResponseModel(
+                (AliITSresponse*)iDetType->GetResponseModel());
+            if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
+                (AliITSsegmentation*)iDetType->GetSegmentationModel());
+            sim->Init();
+        } // end if
+    }// end if iDetType
+    iDetType  = DetType(kSDD);
+    if(iDetType){
+        sim = iDetType->GetSimulationModel();
+        if (!sim) {
+            seg = (AliITSsegmentation*)iDetType->GetSegmentationModel();
+            res =  (AliITSresponse*)iDetType->GetResponseModel();
+            sim = new AliITSsimulationSDD(seg,res);
+            SetSimulationModel(kSDD,sim);
+        }else{ // simulation exists, make sure it is set up properly.
+            if(sim->GetResponseModel()==0) sim->SetResponseModel(
+                (AliITSresponse*)iDetType->GetResponseModel());
+            if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
+                (AliITSsegmentation*)iDetType->GetSegmentationModel());
+            sim->Init();
+        } //end if
+    }// end if iDetType
+    iDetType = DetType(kSSD);
+    if(iDetType){
+        sim = iDetType->GetSimulationModel();
+        if (!sim) {
+            seg =(AliITSsegmentation*)iDetType->GetSegmentationModel();
+            res =  (AliITSresponse*)iDetType->GetResponseModel();
+            sim = new AliITSsimulationSSD(seg,res);
+            SetSimulationModel(kSSD,sim);
+        }else{ // simulation exists, make sure it is set up properly.
+            if(sim->GetResponseModel()==0) sim->SetResponseModel(
+                (AliITSresponse*)iDetType->GetResponseModel());
+            if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
+                (AliITSsegmentation*)iDetType->GetSegmentationModel());
+            sim->Init();
+        } // end if
+    } // end if iDetType
 }
 //______________________________________________________________________
 void AliITS::SetDefaultClusterFinders(){
@@ -502,44 +507,48 @@ void AliITS::SetDefaultClusterFinders(){
     //      none.
     // Return:
     //      none.
+    AliITSDetType *iDetType;
+    AliITSsegmentation *seg;
+    AliITSClusterFinder *clf;
+    AliITSresponse *res;
 
     MakeTreeC();
-    AliITSDetType *iDetType;
 
     // SPD
-    iDetType=DetType(0);
-    if (!iDetType->GetReconstructionModel()) {
-        AliITSsegmentation *seg0 =
-            (AliITSsegmentation*)iDetType->GetSegmentationModel();
-        TClonesArray *dig0=DigitsAddress(0);
-        TClonesArray *recp0=ClustersAddress(0);
-        AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0,
-                                                                  recp0);
-        SetReconstructionModel(0,rec0);
-    } // end if
+    iDetType=DetType(kSPD);
+    if(iDetType){
+        if (!iDetType->GetReconstructionModel()) {
+            seg =(AliITSsegmentation*)iDetType->GetSegmentationModel();
+            TClonesArray  *dig0 = DigitsAddress(0);
+            TClonesArray *recp0 = ClustersAddress(0);
+            clf = new AliITSClusterFinderSPD(seg,dig0,recp0);
+            SetReconstructionModel(kSPD,clf);
+        } // end if
+    } // end if iDetType
 
     // SDD
-    iDetType=DetType(1);
-    if (!iDetType->GetReconstructionModel()) {
-        AliITSsegmentation *seg1 =
-            (AliITSsegmentation*)iDetType->GetSegmentationModel();
-        AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
-        TClonesArray *dig1=DigitsAddress(1);
-        TClonesArray *recp1=ClustersAddress(1);
-        AliITSClusterFinderSDD *rec1 =
-            new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
-      SetReconstructionModel(1,rec1);
-    } // end if
+    iDetType=DetType(kSDD);
+    if(iDetType){
+        if (!iDetType->GetReconstructionModel()) {
+            seg = (AliITSsegmentation*)iDetType->GetSegmentationModel();
+            res = (AliITSresponse*)iDetType->GetResponseModel();
+            TClonesArray  *dig1 = DigitsAddress(1);
+            TClonesArray *recp1 = ClustersAddress(1);
+            clf = new AliITSClusterFinderSDD(seg,res,dig1,recp1);
+            SetReconstructionModel(kSDD,clf);
+        } // end if
+    } // end if iDetType
 
     // SSD
-    iDetType=DetType(2);
-    if (!iDetType->GetReconstructionModel()) {
-        AliITSsegmentation *seg2=
-            (AliITSsegmentation*)iDetType->GetSegmentationModel();
-        TClonesArray *dig2=DigitsAddress(2);
-        AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2);
-        SetReconstructionModel(2,rec2);
-    } // end if
+    iDetType=DetType(kSSD);
+    if(iDetType){
+        if (!iDetType->GetReconstructionModel()) {
+            seg = (AliITSsegmentation*)iDetType->GetSegmentationModel();
+            TClonesArray *dig2 = DigitsAddress(2);
+            clf = new AliITSClusterFinderSSD(seg,dig2);
+            SetReconstructionModel(kSSD,clf);
+        } // end if
+    } // end if iDetType
 }
 //______________________________________________________________________
 void AliITS::MakeBranch(Option_t* option){
@@ -582,8 +591,9 @@ void AliITS::SetTreeAddress(){
     TTree *treeS = fLoader->TreeS();
     TTree *treeD = fLoader->TreeD();
     TTree *treeR = fLoader->TreeR();
-    if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560);
-      
+    if (fLoader->TreeH() && (fHits == 0x0)) 
+        fHits = new TClonesArray("AliITShit", 1560);
+
     AliDetector::SetTreeAddress();
 
     SetTreeAddressS(treeS);
@@ -591,92 +601,6 @@ void AliITS::SetTreeAddress(){
     SetTreeAddressR(treeR);
 }
 //______________________________________________________________________
-AliITSDetType* AliITS::DetType(Int_t id){
-    // Return pointer to id detector type.
-    // Inputs:
-    //      Int_t id   detector id number.
-    // Outputs:
-    //      none.
-    // Return:
-    //      returned, a pointer to a AliITSDetType.
-
-    return ((AliITSDetType*) fDetTypes->At(id));
-}
-//______________________________________________________________________
-void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){
-    // Set the response model for the id detector type.
-    // Inputs:
-    //      Int_t id        detector id number.
-    //      AliITSresponse* a pointer containing an instance of AliITSresponse
-    //                      to be stored/owned b y AliITSDetType.
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
-
-    ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);
-}
-//______________________________________________________________________
-void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
-    // Set the segmentation model for the id detector type.
-    // Inputs:
-    //      Int_t id            detector id number.
-    //      AliITSsegmentation* a pointer containing an instance of 
-    //                          AliITSsegmentation to be stored/owned b y 
-    //                          AliITSDetType.
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
-
-    ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);
-}
-//______________________________________________________________________
-void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){
-    // Set the simulation model for the id detector type.
-    // Inputs:
-    //      Int_t id        detector id number.
-    //      AliITSresponse* a pointer containing an instance of AliITSresponse
-    //                      to be stored/owned b y AliITSDetType.
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
-
-   ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);
-
-}
-//______________________________________________________________________
-void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){
-    // Set the cluster finder model for the id detector type.
-    // Inputs:
-    //      Int_t id             detector id number.
-    //      AliITSClusterFinder* a pointer containing an instance of 
-    //                           AliITSClusterFinder to be stored/owned b y 
-    //                           AliITSDetType.
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
-
-    ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst);
-}
-//______________________________________________________________________
-void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){
-    // Set the digit and cluster classes name to be used for the id detector
-    // type.
-    // Inputs:
-    //      Int_t id            detector id number.
-    //      const char *digit   Digit class name for detector id.
-    //      const char *cluster Cluster class name for detector id.
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
-
-    ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);
-}
-//______________________________________________________________________
 void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){
     // Add an ITS hit
     //     The function to add information to the AliITShit class. See the
@@ -841,16 +765,6 @@ void AliITS::FillModules(TTree *treeH, Int_t mask) {
     } // end loop over tracks
 }
 //______________________________________________________________________
-void AliITS::ClearModules(){
-    // Clear the modules TObjArray.
-    // Inputs:
-    //      none.
-    // Outputs:
-    //      none.
-
-    if(fITSmodules) fITSmodules->Delete();
-}
-//______________________________________________________________________
 void AliITS::MakeBranchS(const char *fl){
     // Creates Tree Branch for the ITS summable digits.
     // Inputs:
@@ -869,7 +783,7 @@ void AliITS::MakeBranchS(const char *fl){
     
 
     if(fLoader->TreeS()){
-        if (fSDigits == 0x0)  fSDigits  = new TClonesArray("AliITSpListItem",1000);
+        if(fSDigits==0x0) fSDigits = new TClonesArray("AliITSpListItem",1000);
         MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl);
     } // end if
 }
@@ -903,29 +817,37 @@ void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){
     //      none.
     // Return:
     //      none.
-    Int_t buffersize = 4000;
-    char branchname[30];
-
-    sprintf(branchname,"%s",GetName());
     // one branch for digits per type of detector
-    const char *det[3] = {"SPD","SDD","SSD"};
-    char digclass[40];
-    char clclass[40];
+    const Char_t *det[3] = {"SPD","SDD","SSD"};
+    TString digclass;
     Int_t i;
+    Int_t buffersize = 4000;
+    Char_t branchname[30];
+
+    if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
     for (i=0; i<kNTYPES ;i++) {
-        DetType(i)->GetClassNames(digclass,clclass);
+        digclass = DetType(i)->GetDigitClassName();
         // digits
-        if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
-        if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
-        else ResetDigits(i);
+        if(!(fDtype->At(i))){
+            fDtype->AddAt(new TClonesArray(digclass.Data(),1000),i);
+        }else{
+            ResetDigits(i);
+        } // end if
+        if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
+        else  sprintf(branchname,"%sDigits%d",GetName(),i+1);      
+        if (fDtype && treeD) {
+            MakeBranchInTree(treeD,branchname,&((*fDtype)[i]),buffersize,file);
+        } // end if
     } // end for i
+         /*
     for (i=0; i<kNTYPES ;i++) {
         if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
         else  sprintf(branchname,"%sDigits%d",GetName(),i+1);      
         if (fDtype && treeD) {
-            MakeBranchInTree(treeD, branchname, &((*fDtype)[i]),buffersize,file);
+            MakeBranchInTree(treeD,branchname,&((*fDtype)[i]),buffersize,file);
         } // end if
     } // end for i
+         */
 }
 //______________________________________________________________________
 void AliITS::SetTreeAddressD(TTree *treeD){
@@ -936,20 +858,22 @@ void AliITS::SetTreeAddressD(TTree *treeD){
     //      none.
     // Return:
     //      none.
-    char branchname[30];
     const char *det[3] = {"SPD","SDD","SSD"};
     TBranch *branch;
-    char digclass[40];
-    char clclass[40];
+    TString digclass;
     Int_t i;
+    char branchname[30];
 
     if(!treeD) return;
+    if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
     for (i=0; i<kNTYPES; i++) {
-        DetType(i)->GetClassNames(digclass,clclass);
+        digclass = DetType(i)->GetDigitClassName();
         // digits
-        if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes);
-        if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i);
-        else ResetDigits(i);
+        if(!(fDtype->At(i))) {
+            fDtype->AddAt(new TClonesArray(digclass.Data(),1000),i);
+        }else{
+            ResetDigits(i);
+        } // end if
         if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
         else  sprintf(branchname,"%sDigits%d",GetName(),i+1);
         if (fDtype) {
@@ -966,43 +890,22 @@ void AliITS::Hits2SDigits(){
     // Outputs:
     //      none.
 
-//    return; // Using Hits in place of the larger sDigits.
     fLoader->LoadHits("read");
     fLoader->LoadSDigits("recreate");
     AliRunLoader* rl = fLoader->GetRunLoader(); 
 
     for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
-    // Do the Hits to Digits operation. Use Standard input values.
-    // Event number from file, no background hit merging , use size from
-    // AliITSgeom class, option="All", input from this file only.
-      rl->GetEvent(iEvent);
-      if (!fLoader->TreeS()) fLoader->MakeTree("S");
-      MakeBranch("S");
-      SetTreeAddress();
-      HitsToSDigits(iEvent,0,-1," ",fOpt," ");
-    }
+        // Do the Hits to Digits operation. Use Standard input values.
+        // Event number from file, no background hit merging , use size from
+        // AliITSgeom class, option="All", input from this file only.
+        rl->GetEvent(iEvent);
+        if (!fLoader->TreeS()) fLoader->MakeTree("S");
+        MakeBranch("S");
+        SetTreeAddress();
+        HitsToPreDigits(iEvent,0,-1," ",fOpt," ");
+    } // end for iEvent
     
     fLoader->UnloadHits();
-    fLoader->UnloadSDigits();
-}
-//______________________________________________________________________
-void AliITS::Hits2PreDigits(){
-    // Standard Hits to summable Digits function.
-    // Inputs:
-    //      none.
-    // Outputs:
-    //      none.
-
-    AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file.
-    // Do the Hits to Digits operation. Use Standard input values.
-    // Event number from file, no background hit merging , use size from
-    // AliITSgeom class, option="All", input from this file only.
-    HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
-}
-//______________________________________________________________________
-AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const
-{
-  return new AliITSDigitizer(manager);
 }
 //______________________________________________________________________
 void AliITS::SDigitsToDigits(Option_t *opt){
@@ -1021,9 +924,9 @@ void AliITS::SDigitsToDigits(Option_t *opt){
                           strstr(opt,"SSD")};
     if( !det[0] && !det[1] && !det[2] ) all = "All";
     else all = 0;
-    static Bool_t setDef=kTRUE;
-    if (setDef) SetDefaultSimulation();
-    setDef=kFALSE;
+    static Bool_t setDef = kTRUE;
+    if(setDef) SetDefaultSimulation();
+    setDef = kFALSE;
 
     AliITSsimulation *sim      = 0;
     AliITSDetType    *iDetType = 0;
@@ -1048,12 +951,12 @@ void AliITS::SDigitsToDigits(Option_t *opt){
             exit(1);
         } // end if !sim
         sim->InitSimulationModule(module,gAlice->GetEvNumber());
-//
+        //
         // add summable digits to module
         this->GetSDigits()->Clear();
         brchSDigits->GetEvent(module);
         sim->AddSDigitsToModule(GetSDigits(),0);
-//
+        //
         // Digitise current module sum(SDigits)->Digits
         sim->FinishSDigitiseModule();
 
@@ -1082,47 +985,23 @@ void AliITS::Hits2Digits(){
     AliRunLoader* rl = fLoader->GetRunLoader(); 
 
     for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
-    // Do the Hits to Digits operation. Use Standard input values.
-    // Event number from file, no background hit merging , use size from
-    // AliITSgeom class, option="All", input from this file only.
-      rl->GetEvent(iEvent);
-      if (!fLoader->TreeD()) fLoader->MakeTree("D");
-      MakeBranch("D");
-      SetTreeAddress();   
-      HitsToDigits(iEvent,0,-1," ",fOpt," ");
-    }
+        // Do the Hits to Digits operation. Use Standard input values.
+        // Event number from file, no background hit merging , use size from
+        // AliITSgeom class, option="All", input from this file only.
+        rl->GetEvent(iEvent);
+        if (!fLoader->TreeD()) fLoader->MakeTree("D");
+        MakeBranch("D");
+        SetTreeAddress();   
+        HitsToDigits(iEvent,0,-1," ",fOpt," ");
+    } // end for iEvent
 
     fLoader->UnloadHits();
     fLoader->UnloadDigits();
 }
 //______________________________________________________________________
-void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
-                          Option_t *option, Option_t *opt, const char *filename){
-    // keep galice.root for signal and name differently the file for 
-    // background when add! otherwise the track info for signal will be lost !
-    // the condition below will disappear when the geom class will be
-    // initialized for all versions - for the moment it is only for v5 !
-    // 7 is the SDD beam test version. Dummy routine. Hits are ITS's Summable
-    // Digits.
-    // Inputs:
-    //      Int_t evnt       Event to be processed.
-    //      Int_t bgrev      Background Hit tree number.
-    //      Int_t nmodules   Not used.
-    //      Option_t *option String indicating if merging hits or not. To
-    //                       merge hits set equal to "Add". Otherwise no
-    //                       background hits are considered.
-    //      Test_t *filename File name containing the background hits..
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
-//    return; // using Hits instead of the larger sdigits.
-
-    HitsToPreDigits(evNumber,bgrev,size,option,opt,filename);
-}
-//______________________________________________________________________
 void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
-                          Option_t *option, Option_t *opt, const char *filename){
+                             Option_t *option,Option_t *opt,
+                             const char *filename){
     //   Keep galice.root for signal and name differently the file for 
     // background when add! otherwise the track info for signal will be lost !
     // the condition below will disappear when the geom class will be
@@ -1187,7 +1066,8 @@ void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
 }
 //______________________________________________________________________
 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
-                          Option_t *option, Option_t *opt, const char *filename){
+                          Option_t *option,Option_t *opt,
+                          const char *filename){
     //   Keep galice.root for signal and name differently the file for 
     // background when add! otherwise the track info for signal will be lost !
     // the condition below will disappear when the geom class will be
@@ -1250,17 +1130,6 @@ void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
     fLoader->TreeD()->Reset();
 }
 //______________________________________________________________________
-void AliITS::ResetSDigits(){
-    // Reset the Summable Digits array.
-    // Inputs:
-    //      none.
-    // Outputs:
-    //      none.
-
-    if (fSDigits) fSDigits->Clear();
-    fNSDigits = 0;
-}
-//______________________________________________________________________
 void AliITS::ResetDigits(){
     // Reset number of digits and the digits array for the ITS detector.
     // Inputs:
@@ -1272,8 +1141,7 @@ void AliITS::ResetDigits(){
 
     Int_t i;
     for (i=0;i<kNTYPES;i++ ) {
-        if (fDtype->At(i))    ((TClonesArray*)fDtype->At(i))->Clear();
-        if (fNdtype)  fNdtype[i]=0;
+        ResetDigits(i);
     } // end for i
 }
 //______________________________________________________________________
@@ -1284,8 +1152,8 @@ void AliITS::ResetDigits(Int_t i){
     // Outputs:
     //      none.
 
-    if (fDtype->At(i))    ((TClonesArray*)fDtype->At(i))->Clear();
-    if (fNdtype)  fNdtype[i]=0;
+    if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear();
+    if (fNdtype)       fNdtype[i]=0;
 }
 //______________________________________________________________________
 void AliITS::AddSumDigit(AliITSpListItem &sdig){
@@ -1367,29 +1235,27 @@ void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
   AliITSresponseSDD *resp = 0;
   switch(id){
   case 0:
-    new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
-    break;
+      new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
+      break;
   case 1:
-    resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel();
-    new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
-                                              hits,charges,resp);
-    break;
+      resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel();
+      new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
+                                                 hits,charges,resp);
+      break;
   case 2:
-    new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
-    break;
+      new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
+      break;
   } // end switch id
 }
-
 //______________________________________________________________________
-void AliITS::Digits2Raw()
-{
-// convert digits of the current event to raw data
+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;
+      Error("Digits2Raw", "no digits tree");
+      return;
   }
   SetTreeAddressD(digits);
 
@@ -1433,107 +1299,97 @@ void AliITS::MakeTreeC(Option_t *option){
   AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;    
     
   if (pITSLoader == 0x0) {
-    Error("MakeTreeC","fLoader == 0x0 option=%s",option);
-    return;
+      Error("MakeTreeC","fLoader == 0x0 option=%s",option);
+      return;
   }
   if (pITSLoader->TreeC() == 0x0) pITSLoader->MakeTree("C");
   MakeBranchC();
 }
+//----------------------------------------------------------------------
+void AliITS::MakeBranchC(){
+    //Makes barnches in treeC
+    AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;    
+    if (pITSLoader == 0x0) {
+        Error("MakeTreeC","fLoader == 0x0");
+        return;
+    }
+    TTree * lTC = pITSLoader->TreeC();
+    if (lTC == 0x0){
+        Error("MakeTreeC","Can not get TreeC from Loader");
+        return;
+    }
 
-void AliITS::MakeBranchC()
-{
-//Makes barnches in treeC
-  AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;    
-  if (pITSLoader == 0x0) 
-   {
-    Error("MakeTreeC","fLoader == 0x0");
-    return;
-   }
-  TTree * lTC = pITSLoader->TreeC();
-  if (lTC == 0x0)
-   {
-     Error("MakeTreeC","Can not get TreeC from Loader");
-     return;
-   }
-
-  Int_t buffersize = 4000;
-  char branchname[30];
-  const char *det[3] = {"SPD","SDD","SSD"};
-  char digclass[40];
-  char clclass[40];
-
+    Int_t buffersize = 4000;
+    char branchname[30];
+    const char *det[3] = {"SPD","SDD","SSD"};
+    char digclass[40];
+    char clclass[40];
+    
     // one branch for Clusters per type of detector
-  Int_t i;   
-  for (i=0; i<kNTYPES ;i++) 
-    {
+    Int_t i;   
+    for (i=0; i<kNTYPES ;i++) {
         AliITSDetType *iDetType=DetType(i); 
         iDetType->GetClassNames(digclass,clclass);
         // clusters
         if (fCtype == 0x0) fCtype  = new TObjArray(fNDetTypes);
-        if(!ClustersAddress(i))
-         {
-          fCtype->AddAt(new TClonesArray(clclass,1000),i);
-         }
+        if(!ClustersAddress(i)){
+            fCtype->AddAt(new TClonesArray(clclass,1000),i);
+        }
         if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
         else  sprintf(branchname,"%sClusters%d",GetName(),i+1);
-        if (fCtype  && lTC) 
-         {
-           if (lTC->GetBranch(branchname))
-            {
-              Warning("MakeBranchC","Branch %s alread exists in TreeC",branchname);
+        if (fCtype  && lTC) {
+            if (lTC->GetBranch(branchname)){
+                Warning("MakeBranchC","Branch %s alread exists in TreeC",
+                        branchname);
+            }else{
+                Info("MakeBranchC","Creating branch %s in TreeC",branchname);
+                lTC->Branch(branchname,&((*fCtype)[i]), buffersize);
             }
-           else
-            {
-              Info("MakeBranchC","Creating branch %s in TreeC",branchname);
-              lTC->Branch(branchname,&((*fCtype)[i]), buffersize);
-            }
-         } // end if fCtype && lTC
-  } // end for i
+        } // end if fCtype && lTC
+    } // end for i
 }
-
 //______________________________________________________________________
 void AliITS::GetTreeC(Int_t event){
-  //    Get the clusters tree for this event and set the branch address.
-  // Inputs:
-  //      Int_t event    Event number for the cluster tree.
-  // Outputs:
-  //      none.
-  // Return:
-  //      none.
-  char branchname[30];
-  const char *det[3] = {"SPD","SDD","SSD"};
-
-  AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
-  TTree * lTC = pITSLoader->TreeC();
+    //    Get the clusters tree for this event and set the branch address.
+    // Inputs:
+    //      Int_t event    Event number for the cluster tree.
+    // Outputs:
+    //      none.
+    // Return:
+    //      none.
+    char branchname[30];
+    const char *det[3] = {"SPD","SDD","SSD"};
 
-  ResetClusters();
-  if (lTC) {
-    pITSLoader->CleanRawClusters();
-  } // end if TreeC()
+    AliITSLoader *pITSLoader = (AliITSLoader*)fLoader;
+    TTree * lTC = pITSLoader->TreeC();
 
+    ResetClusters();
+    if (lTC) {
+        pITSLoader->CleanRawClusters();
+    } // end if TreeC()
 
-  TBranch *branch;
+    TBranch *branch;
 
-  if (lTC) {
-    Int_t i;
+    if (lTC) {
+        Int_t i;
         char digclass[40];
         char clclass[40];
         for (i=0; i<kNTYPES; i++) {
-      AliITSDetType *iDetType=DetType(i); 
-      iDetType->GetClassNames(digclass,clclass);
-      // clusters
-      if (fCtype == 0x0) fCtype  = new TObjArray(fNDetTypes);
-      if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i);
-      if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
-      else  sprintf(branchname,"%sClusters%d",GetName(),i+1);
-      if (fCtype) {
+            AliITSDetType *iDetType=DetType(i); 
+            iDetType->GetClassNames(digclass,clclass);
+            // clusters
+            if (fCtype == 0x0) fCtype  = new TObjArray(fNDetTypes);
+            if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i);
+            if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]);
+            else  sprintf(branchname,"%sClusters%d",GetName(),i+1);
+            if (fCtype) {
                 branch = lTC->GetBranch(branchname);
-        if (branch) branch->SetAddress(&((*fCtype)[i]));
-      } // end if fCtype
+                if (branch) branch->SetAddress(&((*fCtype)[i]));
+            } // end if fCtype
         } // end for i
-  } else {
+    } else {
         Error("GetTreeC","cannot find Clusters Tree for event:%d",event);
-  } // end if lTC
+    } // end if lTC
 }
 //______________________________________________________________________
 void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){
@@ -1562,17 +1418,6 @@ void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){
     } // end switch id
 }
 //______________________________________________________________________
-void AliITS::ResetClusters(){
-    // Reset number of clusters and the clusters array for ITS.
-    // Inputs:
-    //      none.
-    // Outputs:
-    //      none.
-
-    Int_t i;
-    for (i=0;i<kNTYPES;i++ ) ResetClusters(i);
-}
-//______________________________________________________________________
 void AliITS::ResetClusters(Int_t i){
     //    Reset number of clusters and the clusters array for this branch.
     // Inputs:
@@ -1602,15 +1447,15 @@ void AliITS::MakeBranchR(const char *file, Option_t *opt){
     // only one branch for rec points for all detector types
     Bool_t oFast= (strstr(opt,"Fast")!=0);
     if(oFast){
-      sprintf(branchname,"%sRecPointsF",GetName());
+        sprintf(branchname,"%sRecPointsF",GetName());
     } else {
-      sprintf(branchname,"%sRecPoints",GetName());
+        sprintf(branchname,"%sRecPoints",GetName());
     }
-    
-    
+
     if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
     if (fLoader->TreeR()) {
-        if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
+        if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
+                                                          1000);
         MakeBranchInTree(fLoader->TreeR(),branchname,&fRecPoints,buffsz,file);
     } // end if
 }
@@ -1626,19 +1471,18 @@ void AliITS::SetTreeAddressR(TTree *treeR){
     char branchname[30];
 
     if(!treeR) return;
-    if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
+    if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
     TBranch *branch;
     sprintf(branchname,"%sRecPoints",GetName());
     branch = treeR->GetBranch(branchname);
     if (branch) {
-      branch->SetAddress(&fRecPoints);
-    }
-    else {
-      sprintf(branchname,"%sRecPointsF",GetName());
-      branch = treeR->GetBranch(branchname);
-      if (branch) {
         branch->SetAddress(&fRecPoints);
-      }
+    }else {
+        sprintf(branchname,"%sRecPointsF",GetName());
+        branch = treeR->GetBranch(branchname);
+        if (branch) {
+            branch->SetAddress(&fRecPoints);
+        }
     }
 }
 //______________________________________________________________________
@@ -1657,7 +1501,8 @@ void AliITS::AddRecPoint(const AliITSRecPoint &r){
 }
 //______________________________________________________________________
 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
-                                  Option_t *opt0,Option_t *opt1, const char *flnm){
+                                  Option_t *opt0,Option_t *opt1,
+                                 const char *flnm){
     // keep galice.root for signal and name differently the file for 
     // background when add! otherwise the track info for signal will be lost !
     // the condition below will disappear when the geom class will be
@@ -1695,48 +1540,33 @@ void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
     //m.b. : this change is nothing but a nice way to make sure
     //the CPU goes up !
     
-    cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl;
-    
+    if(GetDebug()) cout<<"HitsToFastRecPoints: N mod = "<<
+                       geom->GetIndexMax()<<endl;
     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 for module %d type %x!",module,
-                 geom->GetModuleTypeName(module));
-           exit(1);
-         } // end if !sim
+        if (!sim) {
+            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);
         sim->CreateFastRecPoints(mod,module,gRandom);
         cout<<module<<"\r";fflush(0);
         //gAlice->TreeR()->Fill();
-       TTree *lTR = pITSloader->TreeR();
+        TTree *lTR = pITSloader->TreeR();
         TBranch *br=lTR->GetBranch("ITSRecPointsF");
         br->Fill();
         ResetRecPoints();
     } // end for module
 
     ClearModules();
-    
     fLoader->WriteRecPoints("OVERWRITE");
 }
 //______________________________________________________________________
-void AliITS::Digits2Reco(){
-    // Find clusters and reconstruct space points.
-    // Inputs:
-    //      none.
-    // Outputs:
-    //      none.
-
-    AliHeader *header=fLoader->GetRunLoader()->GetHeader();
-    // to Digits to RecPoints for event in file, all digits in file, and
-    // all ITS detectors.
-    DigitsToRecPoints(header->GetEvent(),0,fOpt);
-}
-//______________________________________________________________________
 void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){
   // cluster finding and reconstruction of space points
   // the condition below will disappear when the geom class will be
@@ -1777,49 +1607,40 @@ void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){
       rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel();
       TClonesArray *itsDigits  = this->DigitsAddress(id);
       if (!rec) {
-         Error("DigitsToRecPoints",
-               "The reconstruction class was not instanciated! event=%d",
-               evNumber);
-         exit(1);
+          Error("DigitsToRecPoints",
+                "The reconstruction class was not instanciated! event=%d",
+                evNumber);
+          exit(1);
       } // end if !rec
       this->ResetDigits();
       TTree *lTD = pITSloader->TreeD();
       if (all) {
-         lTD->GetEvent(lastentry+module);
+          lTD->GetEvent(lastentry+module);
       }else {
-         lTD->GetEvent(lastentry+(module-first));
+          lTD->GetEvent(lastentry+(module-first));
       }
       Int_t ndigits = itsDigits->GetEntriesFast();
-      if (ndigits) rec->FindRawClusters(module);
+      if(ndigits>0){
+          rec->SetDigits(DigitsAddress(id));
+          rec->SetClusters(ClustersAddress(id));
+          rec->FindRawClusters(module);
+      } // end if
       pITSloader->TreeR()->Fill(); 
       ResetRecPoints();
       treeC->Fill();
       ResetClusters();
   } // end for module
 
-
   pITSloader->WriteRecPoints("OVERWRITE");
   pITSloader->WriteRawClusters("OVERWRITE");
 }
 //______________________________________________________________________
-void AliITS::ResetRecPoints(){
-    // Reset number of rec points and the rec points array.
-    // Inputs:
-    //      none.
-    // Outputs:
-    //      none.
-
-    if (fRecPoints) fRecPoints->Clear();
-    fNRecPoints = 0;
+AliLoader* AliITS::MakeLoader(const char* topfoldername){ 
+    //builds ITSgetter (AliLoader type)
+    //if detector wants to use castomized getter, it must overload this method
+
+    Info("MakeLoader","Creating AliITSLoader. Top folder is %s.",
+         topfoldername);
+    fLoader = new AliITSLoader(GetName(),topfoldername);
+    return fLoader;
 }
-//______________________________________________________________________
-AliLoader* AliITS::MakeLoader(const char* topfoldername)
-{ 
-  //builds ITSgetter (AliLoader type)
-  //if detector wants to use castomized getter, it must overload this method
-
-  Info("MakeLoader","Creating AliITSLoader. Top folder is %s.",topfoldername);
-  fLoader = new AliITSLoader(GetName(),topfoldername);
-  return fLoader;
-}
-
index acf9f37..29aec99 100644 (file)
@@ -34,6 +34,8 @@ class AliITSRecPoint;
 class AliITSRawCluster;
 class AliITSmodule;
 class AliVertexer;
+class AliDigitizer;
+class AliRunDigitizer;
 
 const Int_t kNTYPES=3;
 
@@ -47,7 +49,7 @@ class AliITS : public AliDetector {
     AliITS(const AliITS &source); // copy constructor. Not to be used!
     AliITS& operator=(AliITS &source); // = operator. Not to be used!
     virtual Int_t IsVersion() const {return 1;}
-    virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) const;
+    virtual Int_t DistancetoPrimitive(Int_t,Int_t) const{return 999;};
 
     //===================== Simulation Geometry ========================
     // get geometry version - detailed (major) or coarse (minor)
@@ -79,7 +81,8 @@ class AliITS : public AliDetector {
     // For a given branch from the treeH sets the TClonesArray address.
     virtual void SetHitsAddressBranch(TBranch *b) {b->SetAddress(&fHits);}
     // Return pointer to DetType #id
-    AliITSDetType *DetType(Int_t id);
+    AliITSDetType *DetType(Int_t id){
+        return ((AliITSDetType*) fDetTypes->At(id));};
     //Int_t           NDetTypes() {return fNDetTypes;}
     //---------- Configuration Methods (per detector type) -------------
     // Determines which ITS subdetectors will be processed. Effects
@@ -88,18 +91,23 @@ class AliITS : public AliDetector {
     // Returns the list of ITS subdetectors that will be processed.
     Option_t* GetDetectors(){return fOpt;}
     // Set response 
-    virtual void SetResponseModel(Int_t id, AliITSresponse *response);
+    virtual void SetResponseModel(Int_t id, AliITSresponse *response){
+        ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response);};
     // Set segmentation 
-    virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg);
+    virtual void SetSegmentationModel(Int_t id, AliITSsegmentation *seg){
+        ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg);};
     // Set simulation - temporary 
-    virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim);
+    virtual void SetSimulationModel(Int_t id, AliITSsimulation *sim){
+        ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim);};
     // Set simulation - temporary 
     virtual AliITSsimulation* GetSimulationModel(Int_t id){
        return ((AliITSDetType*)(fDetTypes->At(id)))->GetSimulationModel();}
     // Set reconstruction 
-    virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec);
+    virtual void SetReconstructionModel(Int_t id, AliITSClusterFinder *rec){
+        ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(rec);};
     // Set class names for digit and rec point 
-    virtual void SetClasses(Int_t id, const char *digit, const char *cluster);
+    virtual void SetClasses(Int_t id, const char *digit, const char *cluster){
+        ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster);};
 
     //=================== Hits =========================================
     virtual void StepManager() {} // See Step Manager for specific geometry.
@@ -109,7 +117,7 @@ class AliITS : public AliDetector {
     virtual void FillModules(TTree *treeH, Int_t mask = 0);
     virtual void FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
                             Option_t *opt, const char *filename);
-    virtual void ClearModules();
+    virtual void ClearModules(){if(fITSmodules) fITSmodules->Delete();};
 
     //===================== Digitisation ===============================
     void MakeBranchS(const char *file);
@@ -120,7 +128,10 @@ class AliITS : public AliDetector {
        MakeBranchInTreeD(GetLoader()->TreeD(),file);}
     void SetTreeAddressD(TTree *treeD);
     void Hits2SDigits(); // Turn hits into SDigits
-    void Hits2PreDigits(); // Turn hits into SDigits
+    void Hits2PreDigits(){ // Turn hits into SDigits
+        HitsToPreDigits(fLoader->GetEvent(),
+            /*fLoader->GetRunLoader()->GetHeader()->GetEvent(),*/
+                        0,-1," ",fOpt," ");};
     AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
     void SDigits2Digits(){SDigitsToDigits("All");} // Turn SDigits to Digits
     void SDigitsToDigits(Option_t *opt="All"); // Turn SDigits to Digits
@@ -128,14 +139,16 @@ class AliITS : public AliDetector {
     //------------------ Internal functions ----------------------------
     // Standard Hits To SDigits function
     void HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
-                 Option_t *add, Option_t *det, const char *filename);
+                       Option_t *add, Option_t *det, const char *filename)
+        {HitsToPreDigits(evNumber,bgrev,size,add,det,filename);};
     // Standard Hits To SDigits function
     void HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
                  Option_t *add, Option_t *det, const char *filename);
     // Standard Hits To Digits function
     void HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
                  Option_t *add, Option_t *det, const char *filename);
-    void ResetSDigits();                  // Resets the Summable digits.
+    // Resets the Summable digits.
+    void ResetSDigits(){if(fSDigits) fSDigits->Clear();fNSDigits = 0;};
     void ResetDigits();                   // depending on how the
     void ResetDigits(Int_t branch);       // tree will be filled only
     void AddSumDigit(AliITSpListItem &sdig);
@@ -159,7 +172,8 @@ class AliITS : public AliDetector {
     void MakeTreeC(Option_t *option="C");
     void GetTreeC(Int_t event);
     void AddCluster(Int_t branch, AliITSRawCluster *c);
-    void ResetClusters();                 // one of the methods in 
+    // one of the methods in
+    void ResetClusters(){for(Int_t i=0;i<kNTYPES;i++ ) ResetClusters(i);}; 
     void ResetClusters(Int_t branch);     // the pair will be kept
     // Return pointers to clusters 
     TObjArray    *Ctype() {return fCtype;}
@@ -175,9 +189,9 @@ class AliITS : public AliDetector {
     void AddRecPoint(const AliITSRecPoint &p);
     void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
                  Option_t *add, Option_t *det, const char *filename);
-    void Digits2Reco();
+    void Digits2Reco(){DigitsToRecPoints(fLoader->GetEvent(),0,fOpt);};
     void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det);
-    void ResetRecPoints();
+    void ResetRecPoints(){if(fRecPoints) fRecPoints->Clear();fNRecPoints = 0;};
     // Return pointer to rec points 
     TClonesArray  *RecPoints()   {return fRecPoints;}
 
index 6c1bd7f..308596d 100644 (file)
 #include "AliITSdigitSPD.h"
 #include "AliITSdigitSDD.h"
 #include "AliITSdigitSSD.h"
+#include "AliITSMap.h"
 #include "AliRun.h"
 #include "AliITS.h"
 
 ClassImp(AliITSClusterFinder)
 
 //----------------------------------------------------------------------
-AliITSClusterFinder::AliITSClusterFinder(){
+AliITSClusterFinder::AliITSClusterFinder():
+TObject(),
+fDebug(0),
+fModule(0),
+fDigits(0),
+fNdigits(0),
+fResponse(0),
+fSegmentation(0),
+fClusters(0),
+fNRawClusters(0),
+fMap(0),
+fNperMax(0),
+fDeclusterFlag(0),
+fClusterSize(0),
+fNPeaks(-1){
     // default cluster finder
-
-    fSegmentation = 0;
-    fResponse     = 0;
-    fMap          = 0;
-    fDigits       = 0;
-    fNdigits      = 0;
-    fNRawClusters = 0;
-    fNperMax      = 0;
-    fDeclusterFlag= 0;
-    fClusterSize  = 0;
-    fNPeaks       = 0;
+    // Input:
+    //   none.
+    // Output:
+    //   none.
+    // Return:
+    //   A default constructed AliITSCulsterFinder
 }
 //----------------------------------------------------------------------
 AliITSClusterFinder::AliITSClusterFinder(AliITSsegmentation *seg, 
-                                        AliITSresponse *response, 
-                                        TClonesArray *digits){
-  // cluster finder
-    fSegmentation=seg;
-    fResponse=response;
-    fMap = 0;
-    
-    fDigits=digits;
-    fNdigits = fDigits->GetEntriesFast();
-
-    fNRawClusters=0;
+                                         AliITSresponse *res):
+TObject(),
+fDebug(0),
+fModule(0),
+fDigits(0),
+fNdigits(0),
+fResponse(res),
+fSegmentation(seg),
+fClusters(0),
+fNRawClusters(0),
+fMap(0),
+fNperMax(0),
+fDeclusterFlag(0),
+fClusterSize(0),
+fNPeaks(-1){
+    // Standard constructor for cluster finder
+    // Input:
+    //   AliITSsegmentation *seg  The segmentation class to be used
+    //   AliITSresponse     *res  The response class to be used
+    // Output:
+    //   none.
+    // Return:
+    //   A Standard constructed AliITSCulsterFinder
 
     SetNperMax();
     SetClusterSize();
     SetDeclusterFlag();
+}
+//----------------------------------------------------------------------
+AliITSClusterFinder::AliITSClusterFinder(AliITSsegmentation *seg, 
+                                         AliITSresponse *response, 
+                                         TClonesArray *digits):
+TObject(),
+fDebug(0),
+fModule(0),
+fDigits(digits),
+fNdigits(0),
+fResponse(response),
+fSegmentation(seg),
+fClusters(0),
+fNRawClusters(0),
+fMap(0),
+fNperMax(0),
+fDeclusterFlag(0),
+fClusterSize(0),
+fNPeaks(-1){
+    // Standard + cluster finder constructor
+    // Input:
+    //   AliITSsegmentation *seg  The segmentation class to be used
+    //   AliITSresponse     *res  The response class to be used
+    //   TClonesArray    *digits  Array of digits to be used
+    // Output:
+    //   none.
+    // Return:
+    //   A Standard constructed AliITSCulsterFinder
 
-    fNPeaks=-1;
+    fNdigits = fDigits->GetEntriesFast();
+    SetNperMax();
+    SetClusterSize();
+    SetDeclusterFlag();
 }
 //----------------------------------------------------------------------
 AliITSClusterFinder::~AliITSClusterFinder(){
     // destructor cluster finder
+    // Input:
+    //   none.
+    // Output:
+    //   none.
+    // Return:
+    //   none.
 
+    if(fMap) {delete fMap;}
     // Zero local pointers. Other classes own these pointers.
     fSegmentation = 0;
     fResponse     = 0;
@@ -82,23 +142,30 @@ AliITSClusterFinder::~AliITSClusterFinder(){
 //__________________________________________________________________________
 AliITSClusterFinder::AliITSClusterFinder(const AliITSClusterFinder &source) :
     TObject(source){
-    //     Copy Constructor 
+    //     Copy Constructor
+    // Input:
+    //   AliITSClusterFinder &source  The class which will become a copy of 
+    //                                this class
+    // Output:
+    //   none.
+    // Return:
+    //   A copy of this class
+
     if(&source == this) return;
-    this->fDigits = source.fDigits;
-    this->fNdigits = source.fNdigits;
-    this->fResponse = source.fResponse;
-    this->fSegmentation = source.fSegmentation;
-    this->fNRawClusters = source.fNRawClusters;
-    this->fMap = source.fMap;
-    this->fNperMax = source.fNperMax;
-    this->fDeclusterFlag = source.fDeclusterFlag;
-    this->fClusterSize = source.fClusterSize;
-    this->fNPeaks = source.fNPeaks;
+    *this = source;
     return;
 }
 //______________________________________________________________________
-AliITSClusterFinder& AliITSClusterFinder::operator=(const AliITSClusterFinder &source) {
+AliITSClusterFinder& AliITSClusterFinder::operator=(const AliITSClusterFinder 
+                                                    &source) {
     //    Assignment operator
+    // Input:
+    //   AliITSClusterFinder &source  The class which will become a copy of 
+    //                                this class
+    // Output:
+    //   none.
+    // Return:
+    //   A copy of this class
 
     if(&source == this) return *this;
     this->fDigits = source.fDigits;
@@ -116,6 +183,13 @@ AliITSClusterFinder& AliITSClusterFinder::operator=(const AliITSClusterFinder &s
 //----------------------------------------------------------------------
 void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c){
     // Add a raw cluster copy to the list
+    // Input:
+    //   Int_t       branch  The branch to which the cluster is to be added to
+    //   AliITSRawCluster *c The cluster to be added to the array of clusters
+    // Output:
+    //   none.
+    // Return:
+    //   none.
 
     AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
     iTS->AddCluster(branch,c); 
@@ -124,7 +198,15 @@ void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c){
 //----------------------------------------------------------------------
 void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c, 
                                     AliITSRecPoint &rp){
-    // Add a raw cluster copy to the list
+    // Add a raw cluster copy to the list and the RecPoint
+    // Input:
+    //   Int_t       branch  The branch to which the cluster is to be added to
+    //   AliITSRawCluster *c The cluster to be added to the array of clusters
+    //   AliITSRecPoint  &rp The RecPoint to be added to the array of RecPoints
+    // Output:
+    //   none.
+    // Return:
+    //   none.
 
     AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
     iTS->AddCluster(branch,c); 
@@ -150,7 +232,7 @@ void AliITSClusterFinder::FindRawClusters(Int_t module){
     Int_t i=0,nc=0,j[4],k,k2=0;
 
     // Copy all digits for this module into a local TObjArray.
-    for(i=0;i<ndigits;i++) digs->AddAt(new AliITSdigit(*((AliITSdigit*)(fDigits->At(i)))),i);
+    for(i=0;i<ndigits;i++) digs->AddAt(new AliITSdigit(*(GetDigit(i))),i);
     digs->Sort();
     // First digit is a cluster.
     i  = 0;
@@ -160,51 +242,53 @@ void AliITSClusterFinder::FindRawClusters(Int_t module){
     clust0->AddAtFree(digs->At(i)); // move owner ship from digs to clusts
     nc++;
     for(i=1;i<ndigits;i++){
-       if(IsNeighbor(digs,i,j)){
-           dig = (AliITSdigit*)(digs->At(j[0]));
-           // Add to existing cluster. Find which cluster this digis 
-           for(k=0;k<nc;k++){
-               clust0 = ((TObjArray*)(clusts->At(k)));
-               if(clust0->IndexOf(dig)>=0) break;
-           } // end for k
-           if(k>=nc){
-               Fatal("FindRawClusters","Digit not found as expected");
-           } // end if
-           if(j[1]>=0){
-               dig = (AliITSdigit*)(digs->At(j[1]));
-               // Add to existing cluster. Find which cluster this digis 
-               for(k2=0;k2<nc;k2++){
-                   clust1 = ((TObjArray*)(clusts->At(k2)));
-                   if(clust1->IndexOf(dig)>=0) break;
-               } // end for k2
-               if(k2>=nc){
-                   Fatal("FindRawClusters","Digit not found as expected");
-               } // end if
-           } // end if j[1]>=0
-           // Found cluster with neighboring digits add this one to it.
-           if(clust0==clust1){ // same cluster
-               clust0->AddAtFree(digs->At(i));
-               clust0 = 0; // finished with cluster. zero for safty
-               clust1 = 0; // finished wit hcluster. zero for safty
-           }else{ // two different clusters which need to be merged.
-               clust0->AddAtFree(digs->At(i)); // Add digit to this cluster.
-               for(k=0;k<clust1->GetEntriesFast();k++){
-                   // move clust1 into clust0
-                   clust0->AddAtFree(clust1->At(k));//move digit to this cluster
-                   clust1->AddAt(0,k); // zero this one
-               } // end for k
-               delete clust1;
-               clusts->AddAt(0,k2); // zero array of clusters element clust1
-               clust0 = 0; // finished with cluster. zero for safty
-               clust1 = 0; // finished wit hcluster. zero for safty
-           } // end if clust0==clust1
-       }else{// New cluster
-           clusts->AddAt(new TObjArray(kelms),nc);
-           clust0 = ((TObjArray*)(clusts->At(nc)));
-           clust0->AddAtFree(digs->At(i));// move owner ship from digs to clusts
-           clust0 = 0; // finished with cluster. zero for safty
-           nc++;
-       } // End if IsNeighbor
+        if(IsNeighbor(digs,i,j)){
+            dig = (AliITSdigit*)(digs->At(j[0]));
+            // Add to existing cluster. Find which cluster this digis 
+            for(k=0;k<nc;k++){
+                clust0 = ((TObjArray*)(clusts->At(k)));
+                if(clust0->IndexOf(dig)>=0) break;
+            } // end for k
+            if(k>=nc){
+                Fatal("FindRawClusters","Digit not found as expected");
+            } // end if
+            if(j[1]>=0){
+                dig = (AliITSdigit*)(digs->At(j[1]));
+                // Add to existing cluster. Find which cluster this digis 
+                for(k2=0;k2<nc;k2++){
+                    clust1 = ((TObjArray*)(clusts->At(k2)));
+                    if(clust1->IndexOf(dig)>=0) break;
+                } // end for k2
+                if(k2>=nc){
+                    Fatal("FindRawClusters","Digit not found as expected");
+                } // end if
+            } // end if j[1]>=0
+            // Found cluster with neighboring digits add this one to it.
+            if(clust0==clust1){ // same cluster
+                clust0->AddAtFree(digs->At(i));
+                clust0 = 0; // finished with cluster. zero for safty
+                clust1 = 0; // finished wit hcluster. zero for safty
+            }else{ // two different clusters which need to be merged.
+                clust0->AddAtFree(digs->At(i)); // Add digit to this cluster.
+                for(k=0;k<clust1->GetEntriesFast();k++){
+                    // move clust1 into clust0
+                    //move digit to this cluster
+                    clust0->AddAtFree(clust1->At(k));
+                    clust1->AddAt(0,k); // zero this one
+                } // end for k
+                delete clust1;
+                clusts->AddAt(0,k2); // zero array of clusters element clust1
+                clust0 = 0; // finished with cluster. zero for safty
+                clust1 = 0; // finished wit hcluster. zero for safty
+            } // end if clust0==clust1
+        }else{// New cluster
+            clusts->AddAt(new TObjArray(kelms),nc);
+            clust0 = ((TObjArray*)(clusts->At(nc)));
+            // move owner ship from digs to clusts
+            clust0->AddAtFree(digs->At(i));
+            clust0 = 0; // finished with cluster. zero for safty
+            nc++;
+        } // End if IsNeighbor
     } // end for i
     // There are now nc clusters in clusts. Each element of clust is an
     // array of digits which are clustered together.
@@ -214,11 +298,11 @@ void AliITSClusterFinder::FindRawClusters(Int_t module){
 
     // clean up at the end.
     for(i=0;i<nc;i++){ 
-       clust0 =(TObjArray*)(clusts->At(i));
-       // Digits deleted below, so zero this TObjArray
-       for(k=0;k<clust0->GetEntriesFast();k++) clust0->AddAt(0,k);
-       delete clust0; // Delete this TObjArray
-       clusts->AddAt(0,i); // Contents deleted above, so zero it.
+        clust0 =(TObjArray*)(clusts->At(i));
+        // Digits deleted below, so zero this TObjArray
+        for(k=0;k<clust0->GetEntriesFast();k++) clust0->AddAt(0,k);
+        delete clust0; // Delete this TObjArray
+        clusts->AddAt(0,i); // Contents deleted above, so zero it.
     } // end for i
     delete clusts; // Delete this TObjArray/
     // Delete the digits then the TObjArray which containted them.
@@ -226,7 +310,7 @@ void AliITSClusterFinder::FindRawClusters(Int_t module){
     delete digs;
 }
 //______________________________________________________________________
-Bool_t AliITSClusterFinder::IsNeighbor(TObjArray *digs,Int_t i,Int_t n[]) const{
+Bool_t AliITSClusterFinder::IsNeighbor(TObjArray *digs,Int_t i,Int_t n[])const{
     // Locagical function which checks to see if digit i has a neighbor.
     // If so, then it returns kTRUE and its neighbor index j.
     // This routine checks if the digits are side by side or one before the
@@ -256,15 +340,82 @@ Bool_t AliITSClusterFinder::IsNeighbor(TObjArray *digs,Int_t i,Int_t n[]) const{
     ix = ((AliITSdigit*)(digs->At(i)))->GetCoord1();
     iz = ((AliITSdigit*)(digs->At(i)))->GetCoord2();
     for(j=0;j<i;j++){
-       jx = ((AliITSdigit*)(digs->At(j)))->GetCoord1();
-       jz = ((AliITSdigit*)(digs->At(j)))->GetCoord2();
-       if(jx+1==ix && jz  ==iz){n[0] = j;nei[0] = kTRUE;}
-       if(jx  ==ix && jz+1==iz){n[1] = j;nei[1] = kTRUE;}
-       if(jx+1==ix && jz+1==iz){n[2] = j;nei[2] = kTRUE;}
-       if(jx+1==ix && jz-1==iz){n[3] = j;nei[3] = kTRUE;}
+        jx = ((AliITSdigit*)(digs->At(j)))->GetCoord1();
+        jz = ((AliITSdigit*)(digs->At(j)))->GetCoord2();
+        if(jx+1==ix && jz  ==iz){n[0] = j;nei[0] = kTRUE;}
+        if(jx  ==ix && jz+1==iz){n[1] = j;nei[1] = kTRUE;}
+        if(jx+1==ix && jz+1==iz){n[2] = j;nei[2] = kTRUE;}
+        if(jx+1==ix && jz-1==iz){n[3] = j;nei[3] = kTRUE;}
     } // end for k
     if(nei[0]||nei[1]) return kTRUE;
     if(kdiagonal&&(nei[2]||nei[3])) return kTRUE;
     // no Neighbors found.
     return kFALSE;
 }
+
+//______________________________________________________________________
+void AliITSClusterFinder::Print(ostream *os){
+    //Standard output format for this class
+    // Inputs:
+    //    ostream *os   Output stream
+    // Output:
+    //    ostream *os   Output stream
+    // Return:
+    //    none.
+
+    *os << fDebug<<",";
+    *os << fModule<<",";
+    *os << fNdigits<<",";
+    *os << fNRawClusters<<",";
+    *os << fNperMax<<",";
+    *os << fDeclusterFlag<<",";
+    *os << fClusterSize<<",";
+    *os << fNPeaks<<endl;
+}
+//______________________________________________________________________
+void AliITSClusterFinder::Read(istream *is){
+    //Standard input for this class
+    // Inputs:
+    //    istream *is   Input stream
+    // Output:
+    //    istream *is   Input stream
+    // Return:
+    //    none.
+
+    *is >> fDebug;
+    *is >> fModule;
+    *is >> fNdigits;
+    *is >> fNRawClusters;
+    *is >> fNperMax;
+    *is >> fDeclusterFlag;
+    *is >> fClusterSize;
+    *is >> fNPeaks;
+}
+//______________________________________________________________________
+ostream &operator<<(ostream &os,AliITSClusterFinder &source){
+    // Standard output streaming function.
+    // Inputs:
+    //    ostream             *os     Output stream
+    //    AliITSClusterFinder &source Class to be printed
+    // Output:
+    //    ostream             *os     Output stream
+    // Return:
+    //    none.
+
+    source.Print(&os);
+    return os;
+}
+//______________________________________________________________________
+istream &operator>>(istream &is,AliITSClusterFinder &source){
+    // Standard output streaming function.
+    // Inputs:
+    //    istream              *is      Input stream
+    //     AliITSClusterFinder &source  Class to be read in.
+    // Output:
+    //    istream              *is      Input stream
+    // Return:
+    //    none.
+
+    source.Read(&is);
+    return is;
+}
index 6c9cfa9..1331ef8 100644 (file)
@@ -10,6 +10,7 @@
 //  ITS Cluster Finder Class                  //
 ////////////////////////////////////////////////
 
+#include <Riostream.h>
 #include <TObject.h>
 #include <TClonesArray.h>
 
@@ -23,91 +24,111 @@ class AliITSRecPoint;
 
 //----------------------------------------------------------------------
 class AliITSClusterFinder :public TObject{
- public:
+  public:
     AliITSClusterFinder(); // Default constructor
+    // Standard Constructor
+    AliITSClusterFinder(AliITSsegmentation *seg, AliITSresponse *resp);
     AliITSClusterFinder(AliITSsegmentation *seg, AliITSresponse *resp,
-                       TClonesArray *digits);// Standard Constructor
+                        TClonesArray *digits);// Standard+ Constructor
     virtual ~AliITSClusterFinder(); // Destructor
     AliITSClusterFinder(const AliITSClusterFinder &source); // copy constructor
     // assignment operator
     AliITSClusterFinder& operator=(const AliITSClusterFinder &source);
-    virtual void SetResponse(AliITSresponse *response) {// set response
-       fResponse=response;}
-    virtual void SetSegmentation(AliITSsegmentation *segmentation) {
-       // set segmentation
-       fSegmentation=segmentation;}
-    virtual void SetDigits(TClonesArray *ITSdigits) {// set digits
-       fDigits=ITSdigits;fNdigits = fDigits->GetEntriesFast();}
-    virtual AliITSdigit* GetDigit(Int_t i){ // Returns ith digit
-       return (AliITSdigit*) fDigits->UncheckedAt(i);}
-    virtual TClonesArray* Digits(){ // Gets fDigits
-       return fDigits;}
-    virtual Int_t   NDigits() const {// Get Number of Digits
-       return fNdigits;}
-    // Standard Getters.
-    virtual AliITSresponse * GetResp(){// Returns fResponse
-       return fResponse;}
-    virtual AliITSsegmentation * GetSeg(){// Returns fSegmentation
-       return fSegmentation;}
-    virtual Int_t GetNRawClusters() const { // returns fNRawClusters
-       return fNRawClusters;}
-    AliITSMap   *Map() {// map
-       return fMap;}
-    virtual Int_t GetNperMax() const { // returns fNperMax
-       return fNperMax;}
-    virtual Int_t GetDeclusterFlag() const { // returns fDeclusterFlag
-       return fDeclusterFlag;}
-    virtual Int_t GetClusterSize() const { // returns fClusterSize
-       return fClusterSize;}
-    virtual Int_t GetNPeaks() const { // returns fNPeaks
-       return fNPeaks;}
     //
-    virtual void AddCluster(Int_t branch, AliITSRawCluster *c);
-    virtual void AddCluster(Int_t branch, AliITSRawCluster *c,
-                           AliITSRecPoint &rp);
+    // Do the Reconstruction.
     virtual void FindRawClusters(Int_t mod=0); // Finds cluster of digits.
+    //
+    // Sets the debug flag for debugging output
+    void SetDebug(Int_t level=1){fDebug=level;}
+    // Clears the debug flag so no debugging output will be generated
+    void SetNoDebug(){fDebug=0;}
+    // Returns the debug flag value
+    Bool_t GetDebug(Int_t level=1)const {return fDebug<=level;}
+    //
+    // Setters and Getters
+    // segmentation
+    virtual void SetSegmentation(AliITSsegmentation *segmentation) {
+        fSegmentation=segmentation;}
+    //Returns fSegmentation
+    virtual AliITSsegmentation* GetSegmentation()const{return fSegmentation;}
+    // Digit
+    virtual void SetDigits(TClonesArray *itsDigits) {// set digits
+        fDigits=itsDigits;fNdigits = fDigits->GetEntriesFast();}
+    virtual AliITSdigit* GetDigit(Int_t i){ // Returns ith digit
+        return (AliITSdigit*) fDigits->UncheckedAt(i);}
+    virtual TClonesArray* Digits(){return fDigits;}// Gets fDigits
+    virtual Int_t   NDigits() const {return fNdigits;}// Get Number of Digits
+    // Response
+    //Return Response
+    virtual AliITSresponse* GetResponse()const{return fResponse;}
+    virtual void SetResponse(AliITSresponse *response) {// set response
+        fResponse=response;}
+    // clulsters
+    // Set fClusters up
+    virtual void SetClusters(TClonesArray *itsClusters){// set clusters
+        fClusters = itsClusters;fNRawClusters = fClusters->GetEntriesFast();}
+    // Get fCluters
+    virtual TClonesArray* Clusters(){return fClusters;}
+    // Get fCluter
+    virtual AliITSRawCluster* Cluster(Int_t i){
+        return (AliITSRawCluster*)(fClusters->At(i));}
+    // Returns the present number of enteries
+    virtual Int_t NClusters()const {return fClusters->GetEntriesFast();}
+    // returns fNRawClusters
+    virtual Int_t GetNRawClusters() const {return fNRawClusters;}
     // Determins if digit i has a neighbor and if so that neighor index is j.
-    virtual Bool_t IsNeighbor(TObjArray *digs,Int_t i,Int_t j[]) const;
+    virtual void AddCluster(Int_t branch,AliITSRawCluster *c);
+    virtual void AddCluster(Int_t branch,AliITSRawCluster *c,
+                            AliITSRecPoint &rp);
+    virtual void   FillCluster(AliITSRawCluster *,Int_t) {}// fiil cluster
+    virtual void   FillCluster(AliITSRawCluster *cluster) {// fill cluster
+        FillCluster(cluster,1);}
+    virtual void FindCluster(Int_t,Int_t,AliITSRawCluster *) {}// find cluster
+    //
+    virtual void SetModule(Int_t module){fModule = module;}// Set module number
+    virtual Int_t GetModule()const{return fModule;}// Returns module number
+    //
+    // RecPoints
     // Given a cluster of digits, creates the nessesary RecPoint. May also
     // do some peak separation.
     virtual void CreateRecPoints(TObjArray *,Int_t){};
-    virtual void FindCluster(Int_t,Int_t,AliITSRawCluster *) {}// find cluster
+    // Others
+    virtual void  SetMap(AliITSMap *m) {fMap=m;}// map
+    AliITSMap* Map(){return fMap;}// map
+    virtual Int_t GetNperMax() const {return fNperMax;}// returns fNperMax
+    // returns fDeclusterFlag
+    virtual Int_t GetDeclusterFlag()const{return fDeclusterFlag;} 
+    // returns fClusterSize
+    virtual Int_t GetClusterSize() const {return fClusterSize;} 
+    virtual Int_t GetNPeaks() const {return fNPeaks;}// returns fNPeaks
+    //
+    virtual Bool_t IsNeighbor(TObjArray *digs,Int_t i,Int_t j[]) const;
     virtual void Decluster(AliITSRawCluster *) {}// Decluster
-    virtual void SetNperMax(Int_t npermax=3) {
-       // Set max. Number of cells per local cluster
-       fNperMax = npermax;
-    }
-    virtual void SetDeclusterFlag(Int_t flag=1) {
-       // Decluster ?
-       fDeclusterFlag =flag;
-    }
-    virtual void SetClusterSize(Int_t clsize=3) {
-       // Set max. cluster size ; bigger clusters will be rejected
-       fClusterSize = clsize;
-    }
-    virtual void CalibrateCOG() {
-       // Self Calibration of COG 
-    }
-    virtual void CorrectCOG(){
-       // correct COG
-    }
-    virtual Bool_t Centered(AliITSRawCluster *) const {// cluster
-       return kTRUE;
-    }
-    virtual void SplitByLocalMaxima(AliITSRawCluster *){}//split by local maxima
-    virtual void   FillCluster(AliITSRawCluster *,Int_t) {}// fiil cluster
-    virtual void   FillCluster(AliITSRawCluster *cluster) {// fill cluster
-       FillCluster(cluster,1);
-    }
-    // set the fitting methods in the derived classes
-    // data members
+    // Set max. Number of cells per local cluster
+    virtual void SetNperMax(Int_t npermax=3) {fNperMax = npermax;}
+    //Decluster
+    virtual void SetDeclusterFlag(Int_t flag=1){fDeclusterFlag=flag;}
+        // Set max. cluster size ; bigger clusters will be rejected
+    virtual void SetClusterSize(Int_t clsize=3) {fClusterSize = clsize;}
+    virtual void CalibrateCOG() {}// Self Calibration of COG 
+    virtual void CorrectCOG(){}// correct COG
+    virtual Bool_t Centered(AliITSRawCluster *) const {return kTRUE;}// cluster
+    //split by local maxima
+    virtual void SplitByLocalMaxima(AliITSRawCluster *){}
+    // IO functions
+    void Print(ostream *os); // Class ascii print function
+    void Read(istream *os);  // Class ascii read function
 
-protected:
+    // data members
+  protected:
+    Int_t              fDebug;         //! Debug flag/level
+    Int_t              fModule;        //! Module number to be reconstuctted
     TClonesArray       *fDigits;       //! digits
     Int_t              fNdigits;       //! num of digits
 
     AliITSresponse     *fResponse;     //! response
-    AliITSsegmentation *fSegmentation; //!segmentation
+    AliITSsegmentation *fSegmentation; //! segmentation
+    TClonesArray       *fClusters;     //! Array of clusters
     Int_t              fNRawClusters;  //! in case we split the cluster
                                        // and want to keep track of 
                                        // the cluster which was splitted
@@ -116,7 +137,10 @@ protected:
     Int_t              fDeclusterFlag; //! DeclusterFlag
     Int_t              fClusterSize;   //! ClusterSize
     Int_t              fNPeaks;        //! NPeaks  
-  
-    ClassDef(AliITSClusterFinder,2) //Class for clustering and reconstruction of space points
+
+    ClassDef(AliITSClusterFinder,3) //Class for clustering and reconstruction of space points
 };
+// Input and output functions for standard C++ input/output.
+ostream &operator<<(ostream &os,AliITSClusterFinder &source);
+istream &operator>>(istream &os,AliITSClusterFinder &source);
 #endif
index 14efeef..0bdb277 100644 (file)
@@ -15,6 +15,9 @@
 /*
   $Id$
   $Log$
+  Revision 1.36  2004/01/27 16:12:03  masera
+  Coding conventions for AliITSdigitXXX classes and AliITSTrackerV1
+
   Revision 1.35  2003/11/10 16:33:50  masera
   Changes to obey our coding conventions
 
 #include "AliITSdigitSDD.h"
 #include "AliITSRawClusterSDD.h"
 #include "AliITSRecPoint.h"
-#include "AliITSsegmentation.h"
+#include "AliITSsegmentationSDD.h"
 #include "AliITSresponseSDD.h"
 #include "AliRun.h"
 
 ClassImp(AliITSClusterFinderSDD)
 
 //______________________________________________________________________
+AliITSClusterFinderSDD::AliITSClusterFinderSDD():
+AliITSClusterFinder(),
+fNclusters(0),
+fDAnode(0.0),
+fDTime(0.0),
+fTimeCorr(0.0),
+fCutAmplitude(0),
+fMinPeak(0),
+fMinCharge(0),
+fMinNCells(0),
+fMaxNCells(0){
+    // default constructor
+}
+//______________________________________________________________________
 AliITSClusterFinderSDD::AliITSClusterFinderSDD(AliITSsegmentation *seg,
                                                AliITSresponse *response,
                                                TClonesArray *digits,
-                                               TClonesArray *recp){
+                                               TClonesArray *recp):
+AliITSClusterFinder(seg,response),
+fNclusters(0),
+fDAnode(0.0),
+fDTime(0.0),
+fTimeCorr(0.0),
+fCutAmplitude(0),
+fMinPeak(0),
+fMinCharge(0),
+fMinNCells(0),
+fMaxNCells(0){
     // standard constructor
 
-    fSegmentation = seg;
-    fResponse     = response;
-    fDigits       = digits;
-    fClusters     = recp;
-    fNclusters    = fClusters->GetEntriesFast();
+    SetDigits(digits);
+    SetClusters(recp);
     SetCutAmplitude();
     SetDAnode();
     SetDTime();
-    SetMinPeak((Int_t)(((AliITSresponseSDD*)fResponse)->GetNoiseAfterElectronics()*5));
+    SetMinPeak((Int_t)(((AliITSresponseSDD*)GetResp())->
+                       GetNoiseAfterElectronics()*5));
     //    SetMinPeak();
     SetMinNCells();
     SetMaxNCells();
     SetTimeCorr();
     SetMinCharge();
-    fMap = new AliITSMapA1(fSegmentation,fDigits,fCutAmplitude);
-}
-//______________________________________________________________________
-AliITSClusterFinderSDD::AliITSClusterFinderSDD(){
-    // default constructor
-
-    fSegmentation = 0;
-    fResponse     = 0;
-    fDigits       = 0;
-    fClusters     = 0;
-    fNclusters    = 0;
-    fMap          = 0;
-    fCutAmplitude = 0;
-    fDAnode = 0;
-    fDTime = 0;
-    fMinPeak = 0;
-    fMinNCells = 0;
-    fMaxNCells = 0;
-    fTimeCorr = 0;
-    fMinCharge = 0;
-    /*
-    SetDAnode();
-    SetDTime();
-    SetMinPeak((Int_t)(((AliITSresponseSDD*)fResponse)->GetNoiseAfterElectronics()*5));
-    SetMinNCells();
-    SetMaxNCells();
-    SetTimeCorr();
-    SetMinCharge();
-    */
-}
-//____________________________________________________________________________
-AliITSClusterFinderSDD::~AliITSClusterFinderSDD(){
-    // destructor
-
-    if(fMap) delete fMap;
+    SetMap(new AliITSMapA1(GetSeg(),Digits(),fCutAmplitude));
 }
 //______________________________________________________________________
-void AliITSClusterFinderSDD::SetCutAmplitude(Float_t nsigma){
+void AliITSClusterFinderSDD::SetCutAmplitude(Double_t nsigma){
     // set the signal threshold for cluster finder
-    Float_t baseline,noise,noiseAfterEl;
+    Double_t baseline,noise,noiseAfterEl;
 
-    fResponse->GetNoiseParam(noise,baseline);
-    noiseAfterEl = ((AliITSresponseSDD*)fResponse)->GetNoiseAfterElectronics();
+    GetResp()->GetNoiseParam(noise,baseline);
+    noiseAfterEl = ((AliITSresponseSDD*)GetResp())->GetNoiseAfterElectronics();
     fCutAmplitude = (Int_t)((baseline + nsigma*noiseAfterEl));
 }
 //______________________________________________________________________
@@ -151,31 +142,31 @@ void AliITSClusterFinderSDD::Find1DClusters(){
     static AliITS *iTS = (AliITS*)gAlice->GetModule("ITS");
   
     // retrieve the parameters 
-    Int_t fNofMaps       = fSegmentation->Npz();
-    Int_t fMaxNofSamples = fSegmentation->Npx();
+    Int_t fNofMaps       = GetSeg()->Npz();
+    Int_t fMaxNofSamples = GetSeg()->Npx();
     Int_t fNofAnodes     = fNofMaps/2;
     Int_t dummy          = 0;
-    Float_t fTimeStep    = fSegmentation->Dpx(dummy);
-    Float_t fSddLength   = fSegmentation->Dx();
-    Float_t fDriftSpeed  = fResponse->DriftSpeed();  
-    Float_t anodePitch   = fSegmentation->Dpz(dummy);
+    Double_t fTimeStep    = GetSeg()->Dpx(dummy);
+    Double_t fSddLength   = GetSeg()->Dx();
+    Double_t fDriftSpeed  = GetResp()->DriftSpeed();  
+    Double_t anodePitch   = GetSeg()->Dpz(dummy);
 
     // map the signal
-    fMap->ClearMap();
-    fMap->SetThreshold(fCutAmplitude);
-    fMap->FillMap();
+    Map()->ClearMap();
+    Map()->SetThreshold(fCutAmplitude);
+    Map()->FillMap();
   
-    Float_t noise;
-    Float_t baseline;
-    fResponse->GetNoiseParam(noise,baseline);
+    Double_t noise;
+    Double_t baseline;
+    GetResp()->GetNoiseParam(noise,baseline);
   
     Int_t nofFoundClusters = 0;
     Int_t i;
-    Float_t **dfadc = new Float_t*[fNofAnodes];
-    for(i=0;i<fNofAnodes;i++) dfadc[i] = new Float_t[fMaxNofSamples];
-    Float_t fadc  = 0.;
-    Float_t fadc1 = 0.;
-    Float_t fadc2 = 0.;
+    Double_t **dfadc = new Double_t*[fNofAnodes];
+    for(i=0;i<fNofAnodes;i++) dfadc[i] = new Double_t[fMaxNofSamples];
+    Double_t fadc  = 0.;
+    Double_t fadc1 = 0.;
+    Double_t fadc2 = 0.;
     Int_t j,k,idx,l,m;
     for(j=0;j<2;j++) {
         for(k=0;k<fNofAnodes;k++) {
@@ -183,14 +174,14 @@ void AliITSClusterFinderSDD::Find1DClusters(){
             // signal (fadc) & derivative (dfadc)
             dfadc[k][255]=0.;
             for(l=0; l<fMaxNofSamples; l++) {
-                fadc2=(Float_t)fMap->GetSignal(idx,l);
-                if(l>0) fadc1=(Float_t)fMap->GetSignal(idx,l-1);
+                fadc2=(Double_t)Map()->GetSignal(idx,l);
+                if(l>0) fadc1=(Double_t)Map()->GetSignal(idx,l-1);
                 if(l>0) dfadc[k][l-1] = fadc2-fadc1;
             } // samples
         } // anodes
 
         for(k=0;k<fNofAnodes;k++) {
-        //cout << "Anode: " << k+1 << ", Wing: " << j+1 << endl;
+            if(GetDebug(5)) cout<<"Anode: "<<k+1<<", Wing: "<<j+1<< endl;
             idx = j*fNofAnodes+k;
             Int_t imax  = 0;
             Int_t imaxd = 0;
@@ -199,8 +190,8 @@ void AliITSClusterFinderSDD::Find1DClusters(){
                 imax  = it;
                 imaxd = it;
                 // maximum of signal          
-                Float_t fadcmax  = 0.;
-                Float_t dfadcmax = 0.;
+                Double_t fadcmax  = 0.;
+                Double_t dfadcmax = 0.;
                 Int_t lthrmina   = 1;
                 Int_t lthrmint   = 3;
                 Int_t lthra      = 1;
@@ -208,18 +199,16 @@ void AliITSClusterFinderSDD::Find1DClusters(){
                 for(m=0;m<20;m++) {
                     Int_t id = it+m;
                     if(id>=fMaxNofSamples) break;
-                    fadc=(float)fMap->GetSignal(idx,id);
+                    fadc=(float)Map()->GetSignal(idx,id);
                     if(fadc > fadcmax) { fadcmax = fadc; imax = id;}
-                    if(fadc > (float)fCutAmplitude) { 
-                        lthrt++; 
-                    } // end if
+                    if(fadc > (float)fCutAmplitude)lthrt++; 
                     if(dfadc[k][id] > dfadcmax) {
                         dfadcmax = dfadc[k][id];
                         imaxd    = id;
                     } // end if
                 } // end for m
                 it = imaxd;
-                if(fMap->TestHit(idx,imax) == kEmpty) {it++; continue;}
+                if(Map()->TestHit(idx,imax) == kEmpty) {it++; continue;}
                 // cluster charge
                 Int_t tstart = it-2;
                 if(tstart < 0) tstart = 0;
@@ -228,11 +217,11 @@ void AliITSClusterFinderSDD::Find1DClusters(){
                 if(ilcl) {
                     nofFoundClusters++;
                     Int_t tstop      = tstart;
-                    Float_t dfadcmin = 10000.;
+                    Double_t dfadcmin = 10000.;
                     Int_t ij;
                     for(ij=0; ij<20; ij++) {
                         if(tstart+ij > 255) { tstop = 255; break; }
-                        fadc=(float)fMap->GetSignal(idx,tstart+ij);
+                        fadc=(float)Map()->GetSignal(idx,tstart+ij);
                         if((dfadc[k][tstart+ij] < dfadcmin) && 
                            (fadc > fCutAmplitude)) {
                             tstop = tstart+ij+5;
@@ -241,16 +230,16 @@ void AliITSClusterFinderSDD::Find1DClusters(){
                         } // end if
                     } // end for ij
 
-                    Float_t clusterCharge = 0.;
-                    Float_t clusterAnode  = k+0.5;
-                    Float_t clusterTime   = 0.;
+                    Double_t clusterCharge = 0.;
+                    Double_t clusterAnode  = k+0.5;
+                    Double_t clusterTime   = 0.;
                     Int_t   clusterMult   = 0;
-                    Float_t clusterPeakAmplitude = 0.;
+                    Double_t clusterPeakAmplitude = 0.;
                     Int_t its,peakpos     = -1;
-                    Float_t n, baseline;
-                    fResponse->GetNoiseParam(n,baseline);
+                    Double_t n, baseline;
+                    GetResp()->GetNoiseParam(n,baseline);
                     for(its=tstart; its<=tstop; its++) {
-                        fadc=(float)fMap->GetSignal(idx,its);
+                        fadc=(float)Map()->GetSignal(idx,its);
                         if(fadc>baseline) fadc -= baseline;
                         else fadc = 0.;
                         clusterCharge += fadc;
@@ -259,12 +248,12 @@ void AliITSClusterFinderSDD::Find1DClusters(){
                         // to get the list of tracks !!!
                         if(fadc > clusterPeakAmplitude) {
                             clusterPeakAmplitude = fadc;
-                            //peakpos=fMap->GetHitIndex(idx,its);
+                            //peakpos=Map()->GetHitIndex(idx,its);
                             Int_t shift = (int)(fTimeCorr/fTimeStep);
                             if(its>shift && its<(fMaxNofSamples-shift))
-                                peakpos  = fMap->GetHitIndex(idx,its+shift);
-                            else peakpos = fMap->GetHitIndex(idx,its);
-                            if(peakpos<0) peakpos =fMap->GetHitIndex(idx,its);
+                                peakpos  = Map()->GetHitIndex(idx,its+shift);
+                            else peakpos = Map()->GetHitIndex(idx,its);
+                            if(peakpos<0) peakpos =Map()->GetHitIndex(idx,its);
                         } // end if
                         clusterTime += fadc*its;
                         if(fadc > 0) clusterMult++;
@@ -275,9 +264,9 @@ void AliITSClusterFinderSDD::Find1DClusters(){
                         } // end if
                     } // end for its
 
-                    Float_t clusteranodePath = (clusterAnode - fNofAnodes/2)*
-                                               anodePitch;
-                    Float_t clusterDriftPath = clusterTime*fDriftSpeed;
+                    Double_t clusteranodePath = (clusterAnode - fNofAnodes/2)*
+                                                 anodePitch;
+                    Double_t clusterDriftPath = clusterTime*fDriftSpeed;
                     clusterDriftPath = fSddLength-clusterDriftPath;
                     if(clusterCharge <= 0.) break;
                     AliITSRawClusterSDD clust(j+1,//i
@@ -302,28 +291,25 @@ void AliITSClusterFinderSDD::Find1DClusters(){
 
     return;
 }
-
-
-
 //______________________________________________________________________
 void AliITSClusterFinderSDD::Find1DClustersE(){
     // find 1D clusters
     static AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
     // retrieve the parameters 
-    Int_t fNofMaps = fSegmentation->Npz();
-    Int_t fMaxNofSamples = fSegmentation->Npx();
+    Int_t fNofMaps = GetSeg()->Npz();
+    Int_t fMaxNofSamples = GetSeg()->Npx();
     Int_t fNofAnodes = fNofMaps/2;
     Int_t dummy=0;
-    Float_t fTimeStep = fSegmentation->Dpx( dummy );
-    Float_t fSddLength = fSegmentation->Dx();
-    Float_t fDriftSpeed = fResponse->DriftSpeed();
-    Float_t anodePitch = fSegmentation->Dpz( dummy );
-    Float_t n, baseline;
-    fResponse->GetNoiseParam( n, baseline );
+    Double_t fTimeStep = GetSeg()->Dpx( dummy );
+    Double_t fSddLength = GetSeg()->Dx();
+    Double_t fDriftSpeed = GetResp()->DriftSpeed();
+    Double_t anodePitch = GetSeg()->Dpz( dummy );
+    Double_t n, baseline;
+    GetResp()->GetNoiseParam( n, baseline );
     // map the signal
-    fMap->ClearMap();
-    fMap->SetThreshold( fCutAmplitude );
-    fMap->FillMap();
+    Map()->ClearMap();
+    Map()->SetThreshold( fCutAmplitude );
+    Map()->FillMap();
     
     Int_t nClu = 0;
     //        cout << "Search  cluster... "<< endl;
@@ -333,18 +319,18 @@ void AliITSClusterFinderSDD::Find1DClustersE(){
             Bool_t on = kFALSE;
             Int_t start = 0;
             Int_t nTsteps = 0;
-            Float_t fmax = 0.;
+            Double_t fmax = 0.;
             Int_t lmax = 0;
-            Float_t charge = 0.;
-            Float_t time = 0.;
-            Float_t anode = k+0.5;
+            Double_t charge = 0.;
+            Double_t time = 0.;
+            Double_t anode = k+0.5;
             Int_t peakpos = -1;
             for( Int_t l=0; l<fMaxNofSamples; l++ ){
-                Float_t fadc = (Float_t)fMap->GetSignal( idx, l );
+                Double_t fadc = (Double_t)Map()->GetSignal( idx, l );
                 if( fadc > 0.0 ){
                     if( on == kFALSE && l<fMaxNofSamples-4){
                         // star RawCluster (reset var.)
-                        Float_t fadc1 = (Float_t)fMap->GetSignal( idx, l+1 );
+                        Double_t fadc1 = (Double_t)Map()->GetSignal( idx, l+1 );
                         if( fadc1 < fadc ) continue;
                         start = l;
                         fmax = 0.;
@@ -364,10 +350,10 @@ void AliITSClusterFinderSDD::Find1DClustersE(){
                         lmax = l; 
                         Int_t shift = (Int_t)(fTimeCorr/fTimeStep + 0.5);
                         if( l > shift && l < (fMaxNofSamples-shift) )  
-                            peakpos = fMap->GetHitIndex( idx, l+shift );
+                            peakpos = Map()->GetHitIndex( idx, l+shift );
                         else
-                            peakpos = fMap->GetHitIndex( idx, l );
-                        if( peakpos < 0) peakpos = fMap->GetHitIndex( idx, l );
+                            peakpos = Map()->GetHitIndex( idx, l );
+                        if( peakpos < 0) peakpos = Map()->GetHitIndex(idx,l);
                     } // end if fadc
                 }else{ // end fadc>0
                     if( on == kTRUE ){        
@@ -378,8 +364,8 @@ void AliITSClusterFinderSDD::Find1DClustersE(){
                             time /= (charge/fTimeStep);   // ns
                                 // time = lmax*fTimeStep;   // ns
                             if( time > fTimeCorr ) time -= fTimeCorr;   // ns
-                            Float_t anodePath = (anode - fNofAnodes/2)*anodePitch;
-                            Float_t driftPath = time*fDriftSpeed;
+                            Double_t anodePath =(anode-fNofAnodes/2)*anodePitch;
+                            Double_t driftPath = time*fDriftSpeed;
                             driftPath = fSddLength-driftPath;
                             AliITSRawClusterSDD clust(j+1,anode,time,charge,
                                                       fmax, peakpos,0.,0.,
@@ -387,7 +373,7 @@ void AliITSClusterFinderSDD::Find1DClustersE(){
                                                       nTsteps,start,stop,
                                                       start, stop, 1, k, k );
                             iTS->AddCluster( 1, &clust );
-                            //        clust.PrintInfo();
+                            if(GetDebug(5)) clust.PrintInfo();
                             nClu++;
                         } // end if nTsteps
                         on = kFALSE;
@@ -396,22 +382,22 @@ void AliITSClusterFinderSDD::Find1DClustersE(){
             } // samples
         } // anodes
     } // wings
-    //        cout << "# Rawclusters " << nClu << endl;         
+    if(GetDebug(3)) cout << "# Rawclusters " << nClu << endl;         
     return; 
 }
 //_______________________________________________________________________
-Int_t AliITSClusterFinderSDD::SearchPeak(Float_t *spect,Int_t xdim,Int_t zdim,
+Int_t AliITSClusterFinderSDD::SearchPeak(Double_t *spect,Int_t xdim,Int_t zdim,
                                          Int_t *peakX, Int_t *peakZ, 
-                                         Float_t *peakAmp, Float_t minpeak ){
+                                         Double_t *peakAmp, Double_t minpeak ){
     // search peaks on a 2D cluster
     Int_t npeak = 0;    // # peaks
     Int_t i,j;
     // search peaks
     for( Int_t z=1; z<zdim-1; z++ ){
         for( Int_t x=1; x<xdim-2; x++ ){
-            Float_t sxz = spect[x*zdim+z];
-            Float_t sxz1 = spect[(x+1)*zdim+z];
-            Float_t sxz2 = spect[(x-1)*zdim+z];
+            Double_t sxz = spect[x*zdim+z];
+            Double_t sxz1 = spect[(x+1)*zdim+z];
+            Double_t sxz2 = spect[(x-1)*zdim+z];
             // search a local max. in s[x,z]
             if( sxz < minpeak || sxz1 <= 0 || sxz2 <= 0 ) continue;
             if( sxz >= spect[(x+1)*zdim+z  ] && sxz >= spect[(x-1)*zdim+z  ] &&
@@ -469,8 +455,8 @@ Int_t AliITSClusterFinderSDD::SearchPeak(Float_t *spect,Int_t xdim,Int_t zdim,
     return( npeak );
 }
 //______________________________________________________________________
-void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Float_t *par,
-                                       Float_t *spe, Float_t *integral){
+void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Double_t *par,
+                                       Double_t *spe, Double_t *integral){
     // function used to fit the clusters
     // par -> parameters..
     // par[0]  number of peaks.
@@ -480,23 +466,23 @@ void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Float_t *par,
     //                 par[i+2] = zpos
     //                 par[i+3] = tau
     //                 par[i+4] = sigma.
-    Int_t electronics = fResponse->Electronics(); // 1 = PASCAL, 2 = OLA
+    Int_t electronics = GetResp()->Electronics(); // 1 = PASCAL, 2 = OLA
     const Int_t knParam = 5;
     Int_t npeak = (Int_t)par[0];
 
-    memset( spe, 0, sizeof( Float_t )*zdim*xdim );
+    memset( spe, 0, sizeof( Double_t )*zdim*xdim );
 
     Int_t k = 1;
     for( Int_t i=0; i<npeak; i++ ){
         if( integral != 0 ) integral[i] = 0.;
-        Float_t sigmaA2 = par[k+4]*par[k+4]*2.;
-        Float_t t2 = par[k+3];   // PASCAL
+        Double_t sigmaA2 = par[k+4]*par[k+4]*2.;
+        Double_t t2 = par[k+3];   // PASCAL
         if( electronics == 2 ) { t2 *= t2; t2 *= 2; } // OLA
         for( Int_t z=0; z<zdim; z++ ){
             for( Int_t x=0; x<xdim; x++ ){
-                Float_t z2 = (z-par[k+2])*(z-par[k+2])/sigmaA2;
-                Float_t x2 = 0.;
-                Float_t signal = 0.;
+                Double_t z2 = (z-par[k+2])*(z-par[k+2])/sigmaA2;
+                Double_t x2 = 0.;
+                Double_t signal = 0.;
                 if( electronics == 1 ){ // PASCAL
                     x2 = (x-par[k+1]+t2)/t2;
                     signal = (x2>0.) ? par[k]*x2*exp(-x2+1.-z2) :0.0; // RCCR2
@@ -505,7 +491,8 @@ void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Float_t *par,
                     x2 = (x-par[k+1])*(x-par[k+1])/t2;
                     signal = par[k]  * exp( -x2 - z2 );
                 } else {
-                 Warning("PeakFunc","Wrong SDD Electronics = %d",electronics);
+                    Warning("PeakFunc","Wrong SDD Electronics = %d",
+                            electronics);
                     // exit( 1 );
                 } // end if electronicx
                 spe[x*zdim+z] += signal;
@@ -517,27 +504,27 @@ void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Float_t *par,
     return;
 }
 //__________________________________________________________________________
-Float_t AliITSClusterFinderSDD::ChiSqr( Int_t xdim, Int_t zdim, Float_t *spe,
-                                        Float_t *speFit ) const{
+Double_t AliITSClusterFinderSDD::ChiSqr( Int_t xdim, Int_t zdim, Double_t *spe,
+                                        Double_t *speFit ) const{
     // EVALUATES UNNORMALIZED CHI-SQUARED
-    Float_t chi2 = 0.;
+    Double_t chi2 = 0.;
     for( Int_t z=0; z<zdim; z++ ){
         for( Int_t x=1; x<xdim-1; x++ ){
             Int_t index = x*zdim+z;
-            Float_t tmp = spe[index] - speFit[index];
+            Double_t tmp = spe[index] - speFit[index];
             chi2 += tmp*tmp;
         } // end for x
     } // end for z
     return( chi2 );
 }
 //_______________________________________________________________________
-void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Float_t *param,
-                                    Float_t *prm0,Float_t *steprm,
-                                    Float_t *chisqr,Float_t *spe,
-                                    Float_t *speFit ){
+void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Double_t *param,
+                                    Double_t *prm0,Double_t *steprm,
+                                    Double_t *chisqr,Double_t *spe,
+                                    Double_t *speFit ){
     // 
     Int_t   k, nnn, mmm, i;
-    Float_t p1, delta, d1, chisq1, p2, chisq2, t, p3, chisq3, a, b, p0, chisqt;
+    Double_t p1, delta, d1, chisq1, p2, chisq2, t, p3, chisq3, a, b, p0, chisqt;
     const Int_t knParam = 5;
     Int_t npeak = (Int_t)param[0];
     for( k=1; k<(npeak*knParam+1); k++ ) prm0[k] = param[k];
@@ -548,7 +535,7 @@ void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Float_t *param,
         // ENSURE THAT STEP SIZE IS SENSIBLY LARGER THAN MACHINE ROUND OFF
         if( fabs( p1 ) > 1.0E-6 ) 
             if ( fabs( delta/p1 ) < 1.0E-4 ) delta = p1/1000;
-            else  delta = (Float_t)1.0E-4;
+            else  delta = (Double_t)1.0E-4;
         //  EVALUATE CHI-SQUARED AT FIRST TWO SEARCH POINTS
         PeakFunc( xdim, zdim, param, speFit );
         chisq1 = ChiSqr( xdim, zdim, spe, speFit );
@@ -593,7 +580,7 @@ void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Float_t *param,
                 if( param[k] < .5 ) param[k] = .5;        
                 break;
             case 4 :
-                if( param[k] < .288 ) param[k] = .288;        // 1/sqrt(12) = 0.288
+                if( param[k] < .288 ) param[k] = .288;// 1/sqrt(12) = 0.288
                 if( param[k] > zdim*.5 ) param[k] = zdim*.5;
                 break;
             }; // end switch
@@ -609,12 +596,12 @@ void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Float_t *param,
         // FIND MINIMUM OF PARABOLA DEFINED BY LAST THREE POINTS
         a = chisq1*(p2-p3)+chisq2*(p3-p1)+chisq3*(p1-p2);
         b = chisq1*(p2*p2-p3*p3)+chisq2*(p3*p3-p1*p1)+chisq3*(p1*p1-p2*p2);
-        if( a!=0 ) p0 = (Float_t)(0.5*b/a);
+        if( a!=0 ) p0 = (Double_t)(0.5*b/a);
         else p0 = 10000;
         //--IN CASE OF NEARLY EQUAL CHI-SQUARED AND TOO SMALL STEP SIZE PREVENT
         //   ERRONEOUS EVALUATION OF PARABOLA MINIMUM
         //---NEXT TWO LINES CAN BE OMITTED FOR HIGHER PRECISION MACHINES
-        //dp = (Float_t) max (fabs(p3-p2), fabs(p2-p1));
+        //dp = (Double_t) max (fabs(p3-p2), fabs(p2-p1));
         //if( fabs( p2-p0 ) > dp ) p0 = p2;
         param[k] = p0;
         // Constrain paramiters
@@ -653,27 +640,27 @@ void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Float_t *param,
 }
 //_________________________________________________________________________
 Int_t AliITSClusterFinderSDD::NoLinearFit( Int_t xdim, Int_t zdim, 
-                                           Float_t *param, Float_t *spe, 
-                                           Int_t *niter, Float_t *chir ){
+                                           Double_t *param, Double_t *spe, 
+                                           Int_t *niter, Double_t *chir ){
     // fit method from Comput. Phys. Commun 46(1987) 149
-    const Float_t kchilmt = 0.01;  //        relative accuracy           
+    const Double_t kchilmt = 0.01;  //        relative accuracy           
     const Int_t   knel = 3;        //        for parabolic minimization  
     const Int_t   knstop = 50;     //        Max. iteration number          
     const Int_t   knParam = 5;
     Int_t npeak = (Int_t)param[0];
     // RETURN IF NUMBER OF DEGREES OF FREEDOM IS NOT POSITIVE 
     if( (xdim*zdim - npeak*knParam) <= 0 ) return( -1 );
-    Float_t degFree = (xdim*zdim - npeak*knParam)-1;
+    Double_t degFree = (xdim*zdim - npeak*knParam)-1;
     Int_t   n, k, iterNum = 0;
-    Float_t *prm0 = new Float_t[npeak*knParam+1];
-    Float_t *step = new Float_t[npeak*knParam+1];
-    Float_t *schi = new Float_t[npeak*knParam+1]; 
-    Float_t *sprm[3];
-    sprm[0] = new Float_t[npeak*knParam+1];
-    sprm[1] = new Float_t[npeak*knParam+1];
-    sprm[2] = new Float_t[npeak*knParam+1];
-    Float_t  chi0, chi1, reldif, a, b, prmin, dp;
-    Float_t *speFit = new Float_t[ xdim*zdim ];
+    Double_t *prm0 = new Double_t[npeak*knParam+1];
+    Double_t *step = new Double_t[npeak*knParam+1];
+    Double_t *schi = new Double_t[npeak*knParam+1]; 
+    Double_t *sprm[3];
+    sprm[0] = new Double_t[npeak*knParam+1];
+    sprm[1] = new Double_t[npeak*knParam+1];
+    sprm[2] = new Double_t[npeak*knParam+1];
+    Double_t  chi0, chi1, reldif, a, b, prmin, dp;
+    Double_t *speFit = new Double_t[ xdim*zdim ];
     PeakFunc( xdim, zdim, param, speFit );
     chi0 = ChiSqr( xdim, zdim, spe, speFit );
     chi1 = chi0;
@@ -690,7 +677,7 @@ Int_t AliITSClusterFinderSDD::NoLinearFit( Int_t xdim, Int_t zdim,
         iterNum++;
             chi0 = chi1;
             Minim( xdim, zdim, param, prm0, step, &chi1, spe, speFit );
-            reldif = ( chi1 > 0 ) ? ((Float_t) fabs( chi1-chi0)/chi1 ) : 0;
+            reldif = ( chi1 > 0 ) ? ((Double_t) fabs( chi1-chi0)/chi1 ) : 0;
         // EXIT conditions
         if( reldif < (float) kchilmt ){
             *chir  = (chi1>0) ? (float) TMath::Sqrt (chi1/degFree) :0;
@@ -719,9 +706,9 @@ Int_t AliITSClusterFinderSDD::NoLinearFit( Int_t xdim, Int_t zdim,
         // -EVALUATE EXTRAPOLATED VALUE OF EACH PARAMETER BY FINDING MINIMUM OF
         //    PARABOLA DEFINED BY LAST THREE CALLS OF MINIM
         for( k=1; k<(npeak*knParam+1); k++ ){
-            Float_t tmp0 = sprm[0][k];
-            Float_t tmp1 = sprm[1][k];
-            Float_t tmp2 = sprm[2][k];
+            Double_t tmp0 = sprm[0][k];
+            Double_t tmp1 = sprm[1][k];
+            Double_t tmp2 = sprm[2][k];
             a  = schi[0]*(tmp1-tmp2) + schi[1]*(tmp2-tmp0);
             a += (schi[2]*(tmp0-tmp1));
             b  = schi[0]*(tmp1*tmp1-tmp2*tmp2);
@@ -751,23 +738,23 @@ void AliITSClusterFinderSDD::ResolveClustersE(){
     Int_t i;
     static AliITS *iTS = (AliITS*)gAlice->GetModule( "ITS" );
     // get number of clusters for this module
-    Int_t nofClusters = fClusters->GetEntriesFast();
+    Int_t nofClusters = NClusters();
     nofClusters -= fNclusters;
-    Int_t fNofMaps = fSegmentation->Npz();
+    Int_t fNofMaps = GetSeg()->Npz();
     Int_t fNofAnodes = fNofMaps/2;
-//    Int_t fMaxNofSamples = fSegmentation->Npx();
+    //Int_t fMaxNofSamples = GetSeg()->Npx();
     Int_t dummy=0;
-    Double_t fTimeStep = fSegmentation->Dpx( dummy );
-    Double_t fSddLength = fSegmentation->Dx();
-    Double_t fDriftSpeed = fResponse->DriftSpeed();
-    Double_t anodePitch = fSegmentation->Dpz( dummy );
-    Float_t n, baseline;
-    fResponse->GetNoiseParam( n, baseline );
-    Int_t electronics = fResponse->Electronics(); // 1 = PASCAL, 2 = OLA
+    Double_t fTimeStep = GetSeg()->Dpx( dummy );
+    Double_t fSddLength = GetSeg()->Dx();
+    Double_t fDriftSpeed = GetResp()->DriftSpeed();
+    Double_t anodePitch = GetSeg()->Dpz( dummy );
+    Double_t n, baseline;
+    GetResp()->GetNoiseParam( n, baseline );
+    Int_t electronics = GetResp()->Electronics(); // 1 = PASCAL, 2 = OLA
 
     for( Int_t j=0; j<nofClusters; j++ ){ 
         // get cluster information
-        AliITSRawClusterSDD *clusterJ=(AliITSRawClusterSDD*) fClusters->At(j);
+        AliITSRawClusterSDD *clusterJ=(AliITSRawClusterSDD*) Cluster(j);
         Int_t astart = clusterJ->Astart();
         Int_t astop = clusterJ->Astop();
         Int_t tstart = clusterJ->Tstartf();
@@ -783,13 +770,13 @@ void AliITSClusterFinderSDD::ResolveClustersE(){
             Warning("ResolveClustersE","xdim: %d , zdim: %d ",xdim,zdim);
             continue;
         }
-        Float_t *sp = new Float_t[ xdim*zdim+1 ];
-        memset( sp, 0, sizeof(Float_t)*(xdim*zdim+1) );
+        Double_t *sp = new Double_t[ xdim*zdim+1 ];
+        memset( sp, 0, sizeof(Double_t)*(xdim*zdim+1) );
         
         // make a local map from cluster region
         for( Int_t ianode=astart; ianode<=astop; ianode++ ){
             for( Int_t itime=tstart; itime<=tstop; itime++ ){
-                Float_t fadc = fMap->GetSignal( ianode, itime );
+                Double_t fadc = Map()->GetSignal( ianode, itime );
                 if( fadc > baseline ) fadc -= (Double_t)baseline;
                 else fadc = 0.;
                 Int_t index = (itime-tstart+1)*zdim+(ianode-astart+1);
@@ -801,38 +788,35 @@ void AliITSClusterFinderSDD::ResolveClustersE(){
         const Int_t kNp = 150;
         Int_t peakX1[kNp];
         Int_t peakZ1[kNp];
-        Float_t peakAmp1[kNp];
+        Double_t peakAmp1[kNp];
         Int_t npeak = SearchPeak(sp,xdim,zdim,peakX1,peakZ1,peakAmp1,fMinPeak);
 
         // if multiple peaks, split cluster
-        if( npeak >= 1 )
-        {
+        if( npeak >= 1 ){
             //        cout << "npeak " << npeak << endl;
             //        clusterJ->PrintInfo();
-            Float_t *par = new Float_t[npeak*5+1];
-            par[0] = (Float_t)npeak;                
+            Double_t *par = new Double_t[npeak*5+1];
+            par[0] = (Double_t)npeak;                
             // Initial parameters in cell dimentions
             Int_t k1 = 1;
             for( i=0; i<npeak; i++ ){
                 par[k1] = peakAmp1[i];
                 par[k1+1] = peakX1[i]; // local time pos. [timebin]
                 par[k1+2] = peakZ1[i]; // local anode pos. [anodepitch]
-                if( electronics == 1 ) 
-                    par[k1+3] = 2.; // PASCAL
-                else if( electronics == 2 ) 
-                    par[k1+3] = 0.7; // tau [timebin]  OLA 
+                if( electronics == 1 ) par[k1+3] = 2.; // PASCAL
+                else if(electronics==2) par[k1+3] = 0.7;//tau [timebin] OLA 
                 par[k1+4] = .4;    // sigma        [anodepich]
-                k1+=5;
+                k1 += 5;
             } // end for i                        
             Int_t niter;
-            Float_t chir;                        
+            Double_t chir;                        
             NoLinearFit( xdim, zdim, par, sp, &niter, &chir );
-            Float_t peakX[kNp];
-            Float_t peakZ[kNp];
-            Float_t sigma[kNp];
-            Float_t tau[kNp];
-            Float_t peakAmp[kNp];
-            Float_t integral[kNp];
+            Double_t peakX[kNp];
+            Double_t peakZ[kNp];
+            Double_t sigma[kNp];
+            Double_t tau[kNp];
+            Double_t peakAmp[kNp];
+            Double_t integral[kNp];
             //get integrals => charge for each peak
             PeakFunc( xdim, zdim, par, sp, integral );
             k1 = 1;
@@ -854,14 +838,14 @@ void AliITSClusterFinderSDD::ResolveClustersE(){
             //    Int_t shift = (Int_t)(fTimeCorr/fTimeStep + 0.5);
             //    if( newiTime > shift && newiTime < (fMaxNofSamples-shift) ) 
             //        shift = 0;
-            //    Int_t peakpos = fMap->GetHitIndex( newAnode, newiTime+shift );
+            //    Int_t peakpos = Map()->GetHitIndex(newAnode,newiTime+shift );
             //    clusterI.SetPeakPos( peakpos );
            
                 clusterI.SetPeakAmpl( peakAmp1[i] );
-                Float_t newAnodef = peakZ[i] - 0.5 + astart;
-                Float_t newiTimef = peakX[i] - 1 + tstart;
+                Double_t newAnodef = peakZ[i] - 0.5 + astart;
+                Double_t newiTimef = peakX[i] - 1 + tstart;
                 if( wing == 2 ) newAnodef -= fNofAnodes; 
-                Float_t anodePath = (newAnodef - fNofAnodes/2)*anodePitch;
+                Double_t anodePath = (newAnodef - fNofAnodes/2)*anodePitch;
                 newiTimef *= fTimeStep;
                 if( newiTimef > fTimeCorr ) newiTimef -= fTimeCorr;
                 if( electronics == 1 ){
@@ -871,24 +855,25 @@ void AliITSClusterFinderSDD::ResolveClustersE(){
                     newiTimef *= 0.99714;    // OLA
                     
                 Int_t timeBin = (Int_t)(newiTimef/fTimeStep+0.5);    
-                Int_t peakpos = fMap->GetHitIndex( newAnode, timeBin );
+                Int_t peakpos = Map()->GetHitIndex( newAnode, timeBin );
                 if( peakpos < 0 ) { 
                     for( Int_t ii=0; ii<3; ii++ ) {
-                        peakpos = fMap->GetHitIndex( newAnode, timeBin+ii );
+                        peakpos = Map()->GetHitIndex( newAnode, timeBin+ii );
                         if( peakpos > 0 ) break;
-                        peakpos = fMap->GetHitIndex( newAnode, timeBin-ii );
+                        peakpos = Map()->GetHitIndex( newAnode, timeBin-ii );
                         if( peakpos > 0 ) break;
                     }
                 }
                 
                 if( peakpos < 0 ) { 
-             //      Warning( "ResolveClustersE", "Digit not found for cluster:\n" );
-             //      clusterI.PrintInfo(); 
+                    //Warning("ResolveClustersE",
+                    //        "Digit not found for cluster");
+                    //if(GetDebug(3)) clusterI.PrintInfo(); 
                    continue;
                 }
                 clusterI.SetPeakPos( peakpos );    
-                Float_t driftPath = fSddLength - newiTimef * fDriftSpeed;
-                Float_t sign = ( wing == 1 ) ? -1. : 1.;
+                Double_t driftPath = fSddLength - newiTimef * fDriftSpeed;
+                Double_t sign = ( wing == 1 ) ? -1. : 1.;
                 clusterI.SetX( driftPath*sign * 0.0001 );        
                 clusterI.SetZ( anodePath * 0.0001 );
                 clusterI.SetAnode( newAnodef );
@@ -899,28 +884,28 @@ void AliITSClusterFinderSDD::ResolveClustersE(){
                 
                 iTS->AddCluster( 1, &clusterI );
             } // end for i
-            fClusters->RemoveAt( j );
+            Clusters()->RemoveAt( j );
             delete [] par;
         } else {  // something odd
-            Warning( "ResolveClustersE","--- Peak not found!!!!  minpeak=%d ,cluster peak= %f , module= %d",
-                      fMinPeak, clusterJ->PeakAmpl(), fModule ); 
+            Warning( "ResolveClustersE",
+                     "--- Peak not found!!!!  minpeak=%d ,cluster peak= %f"
+                     " , module= %d",
+                     fMinPeak, clusterJ->PeakAmpl(),GetModule()); 
             clusterJ->PrintInfo();
             Warning( "ResolveClustersE"," xdim= %d zdim= %d", xdim-2, zdim-2 );
         }
         delete [] sp;
     } // cluster loop
-    fClusters->Compress();
-//    fMap->ClearMap(); 
+    Clusters()->Compress();
+//    Map()->ClearMap(); 
 }
-
-
 //________________________________________________________________________
 void  AliITSClusterFinderSDD::GroupClusters(){
     // group clusters
     Int_t dummy=0;
-    Float_t fTimeStep = fSegmentation->Dpx(dummy);
+    Double_t fTimeStep = GetSeg()->Dpx(dummy);
     // get number of clusters for this module
-    Int_t nofClusters = fClusters->GetEntriesFast();
+    Int_t nofClusters = NClusters();
     nofClusters -= fNclusters;
     AliITSRawClusterSDD *clusterI;
     AliITSRawClusterSDD *clusterJ;
@@ -931,23 +916,25 @@ void  AliITSClusterFinderSDD::GroupClusters(){
         if(label[i] != 0) continue;
         for(j=i+1; j<nofClusters; j++) { 
             if(label[j] != 0) continue;
-            clusterI = (AliITSRawClusterSDD*) fClusters->At(i);
-            clusterJ = (AliITSRawClusterSDD*) fClusters->At(j);
+            clusterI = (AliITSRawClusterSDD*) Cluster(i);
+            clusterJ = (AliITSRawClusterSDD*) Cluster(j);
             // 1.3 good
             if(clusterI->T() < fTimeStep*60) fDAnode = 4.2;  // TB 3.2  
             if(clusterI->T() < fTimeStep*10) fDAnode = 1.5;  // TB 1.
             Bool_t pair = clusterI->Brother(clusterJ,fDAnode,fDTime);
             if(!pair) continue;
-            //      clusterI->PrintInfo();
-            //      clusterJ->PrintInfo();
+            if(GetDebug(4)){
+                clusterI->PrintInfo();
+                clusterJ->PrintInfo();
+            } // end if GetDebug
             clusterI->Add(clusterJ);
             label[j] = 1;
-            fClusters->RemoveAt(j);
+            Clusters()->RemoveAt(j);
             j=i; // <- Ernesto
         } // J clusters  
         label[i] = 1;
     } // I clusters
-    fClusters->Compress();
+    Clusters()->Compress();
 
     delete [] label;
     return;
@@ -955,16 +942,16 @@ void  AliITSClusterFinderSDD::GroupClusters(){
 //________________________________________________________________________
 void AliITSClusterFinderSDD::SelectClusters(){
     // get number of clusters for this module
-    Int_t nofClusters = fClusters->GetEntriesFast();
+    Int_t nofClusters = NClusters();
 
     nofClusters -= fNclusters;
     Int_t i;
     for(i=0; i<nofClusters; i++) { 
-        AliITSRawClusterSDD *clusterI =(AliITSRawClusterSDD*) fClusters->At(i);
+        AliITSRawClusterSDD *clusterI =(AliITSRawClusterSDD*) Cluster(i);
         Int_t rmflg = 0;
-        Float_t wy = 0.;
+        Double_t wy = 0.;
         if(clusterI->Anodes() != 0.) {
-            wy = ((Float_t) clusterI->Samples())/clusterI->Anodes();
+            wy = ((Double_t) clusterI->Samples())/clusterI->Anodes();
         } // end if
         Int_t amp = (Int_t) clusterI->PeakAmpl();
         Int_t cha = (Int_t) clusterI->Q();
@@ -972,9 +959,9 @@ void AliITSClusterFinderSDD::SelectClusters(){
         if(cha < fMinCharge) rmflg = 1;
         if(wy < fMinNCells) rmflg = 1;
         //if(wy > fMaxNCells) rmflg = 1;
-        if(rmflg) fClusters->RemoveAt(i);
+        if(rmflg) Clusters()->RemoveAt(i);
     } // I clusters
-    fClusters->Compress();
+    Clusters()->Compress();
     return;
 }
 //__________________________________________________________________________
@@ -982,28 +969,28 @@ void AliITSClusterFinderSDD::ResolveClusters(){
     // The function to resolve clusters if the clusters overlapping exists
 /*    AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
     // get number of clusters for this module
-    Int_t nofClusters = fClusters->GetEntriesFast();
+    Int_t nofClusters = NClusters();
     nofClusters -= fNclusters;
     //cout<<"Resolve Cl: nofClusters, fNclusters ="<<nofClusters<<","
     // <<fNclusters<<endl;
-    Int_t fNofMaps = fSegmentation->Npz();
+    Int_t fNofMaps = GetSeg()->Npz();
     Int_t fNofAnodes = fNofMaps/2;
     Int_t dummy=0;
-    Double_t fTimeStep = fSegmentation->Dpx(dummy);
-    Double_t fSddLength = fSegmentation->Dx();
-    Double_t fDriftSpeed = fResponse->DriftSpeed();
-    Double_t anodePitch = fSegmentation->Dpz(dummy);
-    Float_t n, baseline;
-    fResponse->GetNoiseParam(n,baseline);
-    Float_t dzz_1A = anodePitch * anodePitch / 12;
+    Double_t fTimeStep = GetSeg()->Dpx(dummy);
+    Double_t fSddLength = GetSeg()->Dx();
+    Double_t fDriftSpeed = GetResp()->DriftSpeed();
+    Double_t anodePitch = GetSeg()->Dpz(dummy);
+    Double_t n, baseline;
+    GetResp()->GetNoiseParam(n,baseline);
+    Double_t dzz_1A = anodePitch * anodePitch / 12;
     // fill Map of signals
-    fMap->FillMap(); 
+    Map()->FillMap(); 
     Int_t j,i,ii,ianode,anode,itime;
     Int_t wing,astart,astop,tstart,tstop,nanode;
     Double_t fadc,ClusterTime;
     Double_t q[400],x[400],z[400]; // digit charges and coordinates
     for(j=0; j<nofClusters; j++) { 
-        AliITSRawClusterSDD *clusterJ=(AliITSRawClusterSDD*) fClusters->At(j);
+        AliITSRawClusterSDD *clusterJ=(AliITSRawClusterSDD*) Cluster(j);
         Int_t ndigits = 0;
         astart=clusterJ->Astart();
         astop=clusterJ->Astop();
@@ -1026,7 +1013,7 @@ void AliITSClusterFinderSDD::ResolveClusters(){
 
         for(ianode=astart; ianode<=astop; ianode++) { 
             for(itime=tstart; itime<=tstop; itime++) { 
-                fadc=fMap->GetSignal(ianode,itime);
+                fadc=Map()->GetSignal(ianode,itime);
                 if(fadc>baseline) {
                     fadc-=(Double_t)baseline;
                     q[ndigits] = fadc*(fTimeStep/160);  // KeV
@@ -1231,23 +1218,23 @@ void AliITSClusterFinderSDD::ResolveClusters(){
             cout << " in: " << endl;
             for (i=0; i<nfhits; i++) {
                 // AliITSRawClusterSDD *clust = new AliITSRawClusterSDD(wing,
-                                               -1,-1,(Float_t)qfit[i],ncl,0,0,
-                                               (Float_t)xfit[i],
-                                               (Float_t)zfit[i],0,0,0,0,
+                                               -1,-1,(Double_t)qfit[i],ncl,0,0,
+                                               (Double_t)xfit[i],
+                                               (Double_t)zfit[i],0,0,0,0,
                                                 tstart,tstop,astart,astop);
-            //        AliITSRawClusterSDD *clust = new AliITSRawClusterSDD(wing,-1,
-            //                                 -1,(Float_t)qfit[i],0,0,0,
-            //                                  (Float_t)xfit[i],
-            //                                  (Float_t)zfit[i],0,0,0,0,
+            //    AliITSRawClusterSDD *clust = new AliITSRawClusterSDD(wing,-1,
+            //                                 -1,(Double_t)qfit[i],0,0,0,
+            //                                  (Double_t)xfit[i],
+            //                                  (Double_t)zfit[i],0,0,0,0,
             //                                  tstart,tstop,astart,astop,ncl);
             // ???????????
             // if(wing == 1) xfit[i] *= (-1);
-            Float_t Anode = (zfit[i]/anodePitch+fNofAnodes/2-0.5);
-            Float_t Time = (fSddLength - xfit[i])/fDriftSpeed;
-            Float_t clusterPeakAmplitude = clusterJ->PeakAmpl();
-            Float_t peakpos = clusterJ->PeakPos();
-            Float_t clusteranodePath = (Anode - fNofAnodes/2)*anodePitch;
-            Float_t clusterDriftPath = Time*fDriftSpeed;
+            Double_t Anode = (zfit[i]/anodePitch+fNofAnodes/2-0.5);
+            Double_t Time = (fSddLength - xfit[i])/fDriftSpeed;
+            Double_t clusterPeakAmplitude = clusterJ->PeakAmpl();
+            Double_t peakpos = clusterJ->PeakPos();
+            Double_t clusteranodePath = (Anode - fNofAnodes/2)*anodePitch;
+            Double_t clusterDriftPath = Time*fDriftSpeed;
             clusterDriftPath = fSddLength-clusterDriftPath;
             AliITSRawClusterSDD *clust = new AliITSRawClusterSDD(wing,Anode,
                                                                  Time,qfit[i],
@@ -1257,16 +1244,16 @@ void AliITSClusterFinderSDD::ResolveClusters(){
                                     ,tstart,tstop,0,0,0,astart,astop);
             clust->PrintInfo();
             iTS->AddCluster(1,clust);
-            //        cout<<"new cluster added: tstart,tstop,astart,astop,x,ncl ="
+            //    cout<<"new cluster added: tstart,tstop,astart,astop,x,ncl ="
             // <<tstart<<","<<tstop<<","<<astart<<","<<astop<<","<<xfit[i]
             // <<","<<ncl<<endl;
             delete clust;
         }// nfhits loop
-        fClusters->RemoveAt(j);
+        Clusters()->RemoveAt(j);
     } // if nfhits = 2
 } // cluster loop
-fClusters->Compress();
-fMap->ClearMap(); 
+Clusters()->Compress();
+Map()->ClearMap(); 
 */
     return;
 }
@@ -1275,30 +1262,30 @@ void AliITSClusterFinderSDD::GetRecPoints(){
     // get rec points
     static AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
     // get number of clusters for this module
-    Int_t nofClusters = fClusters->GetEntriesFast();
+    Int_t nofClusters = NClusters();
     nofClusters -= fNclusters;
-    const Float_t kconvGeV = 1.e-6; // GeV -> KeV
-    const Float_t kconv = 1.0e-4; 
-    const Float_t kRMSx = 38.0*kconv; // microns->cm ITS TDR Table 1.3
-    const Float_t kRMSz = 28.0*kconv; // microns->cm ITS TDR Table 1.3
+    const Double_t kconvGeV = 1.e-6; // GeV -> KeV
+    const Double_t kconv = 1.0e-4; 
+    const Double_t kRMSx = 38.0*kconv; // microns->cm ITS TDR Table 1.3
+    const Double_t kRMSz = 28.0*kconv; // microns->cm ITS TDR Table 1.3
     Int_t i;
     Int_t ix, iz, idx=-1;
     AliITSdigitSDD *dig=0;
-    Int_t ndigits=fDigits->GetEntriesFast();
+    Int_t ndigits=NDigits();
     for(i=0; i<nofClusters; i++) { 
-        AliITSRawClusterSDD *clusterI = (AliITSRawClusterSDD*)fClusters->At(i);
+        AliITSRawClusterSDD *clusterI = (AliITSRawClusterSDD*)Cluster(i);
         if(!clusterI) Error("SDD: GetRecPoints","i clusterI ",i,clusterI);
         if(clusterI) idx=clusterI->PeakPos();
         if(idx>ndigits) Error("SDD: GetRecPoints","idx ndigits",idx,ndigits);
         // try peak neighbours - to be done 
-        if(idx&&idx<= ndigits) dig =(AliITSdigitSDD*)fDigits->UncheckedAt(idx);
+        if(idx&&idx<= ndigits) dig =(AliITSdigitSDD*)GetDigit(idx);
         if(!dig) {
             // try cog
-            fSegmentation->GetPadIxz(clusterI->X(),clusterI->Z(),ix,iz);
-            dig = (AliITSdigitSDD*)fMap->GetHit(iz-1,ix-1);
+            GetSeg()->GetPadIxz(clusterI->X(),clusterI->Z(),ix,iz);
+            dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix-1);
             // if null try neighbours
-            if (!dig) dig = (AliITSdigitSDD*)fMap->GetHit(iz-1,ix); 
-            if (!dig) dig = (AliITSdigitSDD*)fMap->GetHit(iz-1,ix+1); 
+            if (!dig) dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix); 
+            if (!dig) dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix+1); 
             if (!dig) printf("SDD: cannot assign the track number!\n");
         } //  end if !dig
         AliITSRecPoint rnew;
@@ -1315,14 +1302,13 @@ void AliITSClusterFinderSDD::GetRecPoints(){
 
         iTS->AddRecPoint(rnew);
     } // I clusters
-//    fMap->ClearMap();
+//    Map()->ClearMap();
 }
 //______________________________________________________________________
 void AliITSClusterFinderSDD::FindRawClusters(Int_t mod){
     // find raw clusters
     
-    fModule = mod;
-    
+    SetModule(mod);
     Find1DClustersE();
     GroupClusters();
     SelectClusters();
index 038784d..655e09f 100644 (file)
 #include "AliITSClusterFinder.h"
 
 class AliITSMapA2;
+class AliITSresponse;
+class AliITSresponseSDD;
+class AliITSsegmentation;
+class AliITSsegmentationSDD;
 class TFile;
 
 class AliITSClusterFinderSDD : public AliITSClusterFinder{
- public:
+  public:
     AliITSClusterFinderSDD
-       (AliITSsegmentation *seg,AliITSresponse *response,
-        TClonesArray *digits,TClonesArray *recpoints);
+        (AliITSsegmentation *seg,AliITSresponse *response,
+         TClonesArray *digits,TClonesArray *recpoints);
     AliITSClusterFinderSDD();
-    virtual ~AliITSClusterFinderSDD();
-
-    virtual void  SetCutAmplitude(Float_t nsigma=4);
+    virtual ~AliITSClusterFinderSDD(){};
+    
+    virtual void  SetCutAmplitude(Double_t nsigma=4);
     virtual Int_t CutAmplitude() const {// get cut amplitude
-       return fCutAmplitude;}
-    virtual void SetDAnode(Float_t danode=4.2) {// setDAnode
-       fDAnode=danode;}
-    virtual Float_t DAnode() const {// get DAnode
-       return fDAnode;}
-    virtual void SetDTime(Float_t dtime=75) {// SetDTime
-       fDTime=dtime;}
-    virtual Float_t DTime() const {// get DTime
-       return fDTime;}
+        return fCutAmplitude;}
+    virtual void SetDAnode(Double_t danode=4.2) {// setDAnode
+        fDAnode=danode;}
+    virtual Double_t DAnode() const {// get DAnode
+        return fDAnode;}
+    virtual void SetDTime(Double_t dtime=75) {// SetDTime
+        fDTime=dtime;}
+    virtual Double_t DTime() const {// get DTime
+        return fDTime;}
     virtual void SetMinPeak(Int_t minpeak=10) {// SetMinPeak
-       fMinPeak=minpeak;}
+        fMinPeak=minpeak;}
     virtual Int_t MinPeak() const {// get MinPeak
-       return fMinPeak;}
+        return fMinPeak;}
     virtual void SetMinCharge(Int_t mincharge=30) {// SetMinCharge
-       fMinCharge=mincharge;}
+        fMinCharge=mincharge;}
     virtual Int_t MinCharge() const {// get MinCharge
-       return fMinCharge;}
+        return fMinCharge;}
     virtual void SetMinNCells(Int_t minc=3) {// setNCells
-       fMinNCells=minc;}
+        fMinNCells=minc;}
     virtual Int_t MinNCells() const {// get MinNCells
-       return fMinNCells;}
+        return fMinNCells;}
     virtual void SetMaxNCells(Int_t maxc=10) {// setNCells
-       fMaxNCells=maxc;}
+        fMaxNCells=maxc;}
     virtual Int_t MaxNCells() const {// get MaxNCells
-       return fMaxNCells;}
-    virtual void SetTimeCorr(Float_t timec=19.3) {// setNCells
-       fTimeCorr=timec;}
-    virtual Float_t TimeCorr() const{// get Time Correction (ns)
-       return fTimeCorr;}
+        return fMaxNCells;}
+    virtual void SetTimeCorr(Double_t timec=19.3) {// setNCells
+        fTimeCorr=timec;}
+    virtual Double_t TimeCorr() const{// get Time Correction (ns)
+        return fTimeCorr;}
 
     // Search for clusters
     virtual void FindRawClusters(Int_t mod=0);
@@ -62,34 +66,37 @@ class AliITSClusterFinderSDD : public AliITSClusterFinder{
     void  GetRecPoints();
     void  ResolveClusters(); // Boris........ 
     void  ResolveClustersE(); // Ernesto 
-    Int_t SearchPeak(Float_t *spect,Int_t xdim,Int_t zdim,Int_t *peakX,
-                    Int_t *peakZ,Float_t *peakAmp,Float_t minpeak); // Ernesto
-    Int_t NoLinearFit( Int_t xdim, Int_t zdim, Float_t *param, Float_t *spe,
-                      Int_t *niter, Float_t *chir );
-    void  Minim( Int_t xdim, Int_t zdim, Float_t *param, Float_t *prm0,
-               Float_t *steprm, Float_t *chisqr,Float_t *spe,Float_t *speFit);
-    Float_t ChiSqr ( Int_t xdim, Int_t zdim, Float_t *spe, Float_t *speFit ) const;
-    void  PeakFunc( Int_t xdim, Int_t zdim, Float_t *par, Float_t *spe,
-                  Float_t *Integral=0 );
+    Int_t SearchPeak(Double_t *spect,Int_t xdim,Int_t zdim,Int_t *peakX,
+                     Int_t *peakZ,Double_t *peakAmp,Double_t minpeak);//Ernesto
+    Int_t NoLinearFit( Int_t xdim, Int_t zdim, Double_t *param, Double_t *spe,
+                       Int_t *niter, Double_t *chir );
+    void  Minim(Int_t xdim,Int_t zdim,Double_t *param,Double_t *prm0,
+             Double_t *steprm,Double_t *chisqr,Double_t *spe,Double_t *speFit);
+    Double_t ChiSqr(Int_t xdim,Int_t zdim,Double_t *spe,Double_t *speFit)const;
+    void  PeakFunc( Int_t xdim, Int_t zdim, Double_t *par, Double_t *spe,
+                    Double_t *Integral=0 );
     void  Print() const;
 
- private:
+  private:
+    virtual AliITSresponseSDD* GetResp()const{
+        return (AliITSresponseSDD*) GetResponse();}//Return Response
+    //Returns fSegmentation
+    virtual AliITSsegmentationSDD* GetSeg()const{
+        return (AliITSsegmentationSDD*)GetSegmentation();} 
     AliITSClusterFinderSDD(const AliITSClusterFinderSDD &source); // copy ctor
     AliITSClusterFinderSDD& operator=(const AliITSClusterFinderSDD &source);
- private:
-    Int_t               fModule;        //! ITS current module 
-    TClonesArray       *fClusters;      //! clusters
+  private:
     Int_t               fNclusters;     //! num of clusters
-    Float_t             fDAnode;        //! fDanode
-    Float_t             fDTime;         //! fDtime
-    Float_t             fTimeCorr;      //! Correction factor along time coord
+    Double_t             fDAnode;        //! fDanode
+    Double_t             fDTime;         //! fDtime
+    Double_t             fTimeCorr;      //! Correction factor along time coord
     Int_t               fCutAmplitude;  //! cut amplitude
     Int_t               fMinPeak;       //! min peak
     Int_t               fMinCharge;     //! min charge
     Int_t               fMinNCells;     //! min num of cells
     Int_t               fMaxNCells;     //! max num of cells
 
-    ClassDef(AliITSClusterFinderSDD,1) // SDD clustering - Piergiorgio C. algo
+    ClassDef(AliITSClusterFinderSDD,2) // SDD clustering - Piergiorgio C. algo
     };
 
 #endif
index 28408dc..bb4195e 100644 (file)
 #include "AliITSdigitSPD.h"
 #include "AliITSRawClusterSPD.h"
 #include "AliITSRecPoint.h"
-#include "AliITSsegmentation.h"
+#include "AliITSresponseSPD.h"
+#include "AliITSsegmentationSPD.h"
 #include "AliRun.h"
 
 //#define DEBUG
 
 ClassImp(AliITSClusterFinderSPD)
 
+//______________________________________________________________________
+AliITSClusterFinderSPD::AliITSClusterFinderSPD():AliITSClusterFinder(),
+fDz(0.0),
+fDx(0.0),
+fMinNCells(0){
+    // constructor
+}
 //----------------------------------------------------------
 AliITSClusterFinderSPD::AliITSClusterFinderSPD(AliITSsegmentation *seg,
-                                              TClonesArray *digits,
-                                              TClonesArray *recp){
+                                               AliITSresponse *res):
+AliITSClusterFinder(seg,res),
+fDz(0.0),
+fDx(0.0),
+fMinNCells(0){
     // constructor
 
-    fSegmentation = seg;
-    fDigits       = digits;
-    fClusters     = recp;
-    fNclusters    = fClusters->GetEntriesFast();
     SetDx();
     SetDz();
 }
-//______________________________________________________________________
-AliITSClusterFinderSPD::AliITSClusterFinderSPD(){
+//----------------------------------------------------------
+AliITSClusterFinderSPD::AliITSClusterFinderSPD(AliITSsegmentation *seg,
+                                               TClonesArray *digits,
+                                               TClonesArray *recp):
+AliITSClusterFinder(seg,0),
+fDz(0.0),
+fDx(0.0),
+fMinNCells(0){
     // constructor
 
-    fSegmentation = 0;
-    fDigits       = 0;
-    fClusters     = 0;
-    fNclusters    = 0;
+    SetDigits(digits);
+    SetClusters(recp);
     SetDx();
     SetDz();
 }
@@ -59,10 +70,9 @@ AliITSClusterFinderSPD::AliITSClusterFinderSPD(
     //     Copy Constructor 
 
     if(&source == this) return;
-    this->fClusters  = source.fClusters ;
-    this->fNclusters = source.fNclusters ;
-    this->fDz        = source.fDz ;
-    this->fDx        = source.fDx ;
+    this->fDz        = source.fDz;
+    this->fDx        = source.fDx;
+    this->fMinNCells = source.fMinNCells;
     return;
 }
 //______________________________________________________________________
@@ -71,10 +81,9 @@ AliITSClusterFinderSPD& AliITSClusterFinderSPD::operator=(
     //    Assignment operator
 
     if(&source == this) return *this;
-    this->fClusters  = source.fClusters ;
-    this->fNclusters = source.fNclusters ;
-    this->fDz        = source.fDz ;
-    this->fDx        = source.fDx ;
+    this->fDz        = source.fDz;
+    this->fDx        = source.fDx;
+    this->fMinNCells = source.fMinNCells;
     return *this;
 }
 //______________________________________________________________________
@@ -90,55 +99,63 @@ void AliITSClusterFinderSPD::FindRawClusters(Int_t module){
     Int_t   *digtr4     = new Int_t[numberd];
     //  output of Cluster Finder    
     Int_t   numberc     = 10000;
-    Float_t *xcenterl   = new Float_t[numberc];
-    Float_t *zcenterl   = new Float_t[numberc];
-    Float_t *errxcenter = new Float_t[numberc];
-    Float_t *errzcenter = new Float_t[numberc];
+    Double_t *xcenterl   = new Double_t[numberc];
+    Double_t *zcenterl   = new Double_t[numberc];
+    Double_t *errxcenter = new Double_t[numberc];
+    Double_t *errzcenter = new Double_t[numberc];
     Int_t   *tr1clus    = new Int_t[numberc];
     Int_t   *tr2clus    = new Int_t[numberc];
     Int_t   *tr3clus    = new Int_t[numberc];
     Int_t   nclus;
 
+    SetModule(module);
     digitcount=0;
-    Int_t ndigits = fDigits->GetEntriesFast();  
+    Int_t ndigits = Digits()->GetEntriesFast();  
     if (!ndigits) return;
 
     AliITSdigitSPD *dig;
-    Int_t ndig,i;
-//    cout << "FindRawcluters"<<endl;
-//    scanf("%d",ndig);
+    Int_t ndig=0,i;
+    if(GetDebug(4)){
+        cout << "FindRawcluters"<<endl;
+        scanf("%d",ndig);
+    } // end if GetDebug
     for(ndig=0; ndig<ndigits; ndig++) {
-       dig= (AliITSdigitSPD*)fDigits->UncheckedAt(ndig);
-       digx[digitcount] = dig->GetCoord2()+1;  //starts at 1
-       digz[digitcount] = dig->GetCoord1()+1;  //starts at 1
-       digtr1[digitcount] = dig->GetTrack(0);
-       digtr2[digitcount] = -3;
-       digtr3[digitcount] = -3;
-       //cout << "digtr1["<<digitcount <<"]="<<digtr1[digitcount];
-       //cout << " fTracks["<<0<<"]="<<dig->fTracks[0]<<": ";
-       i=1;
-       while(digtr1[digitcount]==dig->GetTrack(i) && i<dig->GetNTracks()) i++;
-       //cout << " fTracks["<<i<<"]="<<dig->fTracks[i];
-       if(i<dig->GetNTracks()){
-           digtr2[digitcount] = dig->GetTrack(i);
-           //cout << "digtr2["<<digitcount <<"]="<<digtr2[digitcount]<<": ";
-           while((digtr1[digitcount]==dig->GetTrack(i) || 
-                  digtr2[digitcount]==dig->GetTrack(i))&&
-                 i<=dig->GetNTracks()) i++;
-           if(i<dig->GetNTracks()) digtr3[digitcount] = dig->GetTrack(i);
-           //cout << " fTracks["<<i<<"]=";
-           //if(i<dig->GetNTracks()) cout <<dig->fTracks[i];
-           //cout << "digtr3["<<digitcount <<"]="<<digtr3[digitcount];
-       } // end if
-       //cout<<endl;
-       digtr4[digitcount] = dig->GetSignal();
-       digitcount++;
+        dig= (AliITSdigitSPD*)GetDigit(ndig);
+        digx[digitcount] = dig->GetCoord2()+1;  //starts at 1
+        digz[digitcount] = dig->GetCoord1()+1;  //starts at 1
+        digtr1[digitcount] = dig->GetTrack(0);
+        digtr2[digitcount] = -3;
+        digtr3[digitcount] = -3;
+        if(GetDebug(5)){
+            cout << "digtr1["<<digitcount <<"]="<<digtr1[digitcount];
+            cout << " fTracks["<<0<<"]="<<dig->GetTrack(0)<<": ";
+        } // end if GetDebug
+        i=1;
+        while(digtr1[digitcount]==dig->GetTrack(i) && i<dig->GetNTracks()) i++;
+        if(GetDebug(5)) cout << " fTracks["<<i<<"]="<<dig->GetTrack(i);
+        if(i<dig->GetNTracks()){
+            digtr2[digitcount] = dig->GetTrack(i);
+            if(GetDebug(5)) cout<<"digtr2["<<digitcount <<"]="
+                                <<digtr2[digitcount]<<": ";
+            while((digtr1[digitcount]==dig->GetTrack(i) || 
+                   digtr2[digitcount]==dig->GetTrack(i))&&
+                  i<=dig->GetNTracks()) i++;
+            if(i<dig->GetNTracks()) digtr3[digitcount] = dig->GetTrack(i);
+            if(GetDebug(5)){
+                cout << " fTracks["<<i<<"]=";
+                if(i<dig->GetNTracks()) cout <<dig->GetTrack(i);
+                cout << "digtr3["<<digitcount <<"]="<<digtr3[digitcount];
+            } // end if GetDebug
+        } // end if
+        if(GetDebug(4)) cout<<endl;
+        digtr4[digitcount] = dig->GetSignal();
+        digitcount++;
     } // end for ndig
     ClusterFinder(digitcount,digx,digz,digtr1,digtr2,digtr3,digtr4,
-                 nclus,xcenterl,zcenterl,errxcenter,errzcenter,
-                 tr1clus, tr2clus, tr3clus,module);
+                  nclus,xcenterl,zcenterl,errxcenter,errzcenter,
+                  tr1clus, tr2clus, tr3clus);
     DigitToPoint(nclus,xcenterl,zcenterl,errxcenter,errzcenter,
-                tr1clus, tr2clus, tr3clus);
+                 tr1clus, tr2clus, tr3clus);
     delete[] digx;
     delete[] digz;
     delete[] digtr1;
@@ -158,11 +175,11 @@ void AliITSClusterFinderSPD::ClusterFinder(Int_t ndigits,Int_t digx[],
                                           Int_t digz[],Int_t digtr1[],
                                           Int_t digtr2[],Int_t digtr3[],
                                           Int_t digtr4[],Int_t &nclus,
-                                          Float_t xcenter[],Float_t zcenter[],
-                                          Float_t errxcenter[],
-                                          Float_t errzcenter[],
+                                          Double_t xcenter[],Double_t zcenter[],
+                                          Double_t errxcenter[],
+                                          Double_t errzcenter[],
                                           Int_t tr1clus[],Int_t tr2clus[],
-                                          Int_t tr3clus[],Int_t module){
+                                          Int_t tr3clus[]){
     // Search for clusters of fired pixels (digits). Two digits are linked
     // inside a cluster if they are countiguous both in row or column
     // direction.  Diagonal digits are not linked.
@@ -175,12 +192,12 @@ void AliITSClusterFinderSPD::ClusterFinder(Int_t ndigits,Int_t digx[],
     Int_t   if1, min, max, nd;
     Int_t   x1, z1, t1, t2, t3, t4;
     Int_t   ndx, ndz, ndxmin=0, ndxmax=0, ndzmin=0, ndzmax=0;
-    Float_t dx, dz; 
+    Double_t dx, dz; 
     Int_t   i,k,ipos=0;
     Float_t xdum, zdum;      
     Int_t   kmax, sigmax;
-    Float_t deltax, deltaz;
-    Float_t ndig;
+    Double_t deltax, deltaz;
+    Double_t ndig;
     Int_t   numberd = 10000;
     Int_t   *ifpad  = new Int_t[numberd];
     Int_t   *xpad   = new Int_t[numberd];
@@ -193,192 +210,192 @@ void AliITSClusterFinderSPD::ClusterFinder(Int_t ndigits,Int_t digx[],
 
     nclus=1;
     for (i=0; i < ndigits ; i++){
-       ifpad[i] = -1;
-       iclus[i] = 0;
+        ifpad[i] = -1;
+        iclus[i] = 0;
     } // end for i
 
     ifpad[0]=0;
     for (i=0; i < ndigits-1 ; i++) {
-       if ( ifpad[i] == -1 ) { 
-           nclus++;
-           ipos++;
-           ifpad[i]=nclus-1;
-       } // end if ipad[i]
-       for (Int_t j=i+1 ; j < ndigits ; j++)  {  
-           if (ifpad[j]== -1 ) {
-               dx = TMath::Abs(digx[i]-digx[j]);
-               dz = TMath::Abs(digz[i]-digz[j]);
-               // if ( ( dx+dz )==1 )  //clusters are not diagonal
-               if(( dx+dz )==1 || (dx==1 && dz==1)){
-                   //diagonal clusters allowed
-                   ipos++;
-                   ifpad[j] = ifpad[i];
-
-                   x1         = digx[j];
-                   z1         = digz[j];
-                   digx[j]    = digx[ipos];
-                   digz[j]    = digz[ipos];
-                   digx[ipos] = x1;
-                   digz[ipos] = z1;
-
-                   t1 = digtr1[j];
-                   t2 = digtr2[j];
-                   t3 = digtr3[j];
-                   t4 = digtr4[j];
-                   digtr1[j] = digtr1[ipos];
-                   digtr2[j] = digtr2[ipos];
-                   digtr3[j] = digtr3[ipos];
-                   digtr4[j] = digtr4[ipos];
-                   digtr1[ipos] = t1;
-                   digtr2[ipos] = t2;
-                   digtr3[ipos] = t3;
-                   digtr4[ipos] = t4;
-
-                   if1 = ifpad[j];
-                   ifpad[j] = ifpad[ipos];
-                   ifpad[ipos] = if1;
-               } // end dx+dx...
-           }// end if ifpad[j]== -1 
-       } // end for j
+        if ( ifpad[i] == -1 ) { 
+            nclus++;
+            ipos++;
+            ifpad[i]=nclus-1;
+        } // end if ipad[i]
+        for (Int_t j=i+1 ; j < ndigits ; j++)  {  
+            if (ifpad[j]== -1 ) {
+                dx = TMath::Abs(digx[i]-digx[j]);
+                dz = TMath::Abs(digz[i]-digz[j]);
+                // if ( ( dx+dz )==1 )  //clusters are not diagonal
+                if(( dx+dz )==1 || (dx==1 && dz==1)){
+                    //diagonal clusters allowed
+                    ipos++;
+                    ifpad[j] = ifpad[i];
+                    
+                    x1         = digx[j];
+                    z1         = digz[j];
+                    digx[j]    = digx[ipos];
+                    digz[j]    = digz[ipos];
+                    digx[ipos] = x1;
+                    digz[ipos] = z1;
+                    
+                    t1 = digtr1[j];
+                    t2 = digtr2[j];
+                    t3 = digtr3[j];
+                    t4 = digtr4[j];
+                    digtr1[j] = digtr1[ipos];
+                    digtr2[j] = digtr2[ipos];
+                    digtr3[j] = digtr3[ipos];
+                    digtr4[j] = digtr4[ipos];
+                    digtr1[ipos] = t1;
+                    digtr2[ipos] = t2;
+                    digtr3[ipos] = t3;
+                    digtr4[ipos] = t4;
+                    
+                    if1 = ifpad[j];
+                    ifpad[j] = ifpad[ipos];
+                    ifpad[ipos] = if1;
+                } // end dx+dx...
+            }// end if ifpad[j]== -1 
+        } // end for j
     }//end loop on digits
     if ( ifpad[ndigits-1] == -1 ) {
-       nclus++;
-       ifpad[ndigits-1]=nclus-1;
+        nclus++;
+        ifpad[ndigits-1]=nclus-1;
     } // end if ifpad[ndigits-1] == -1
-
+    
     for (i=0 ; i < ndigits ; i++) iclus[ifpad[i]]++;
 
     min=0;
     max=0;
     // loop on found clusters 
     for (i=0 ; i < nclus ; i++){
-       min = max;
-       max += iclus[i];
-       deltax = fSegmentation->Dpx(0);
-       if (iclus[i]!=1){
-           //cluster with more than one digit
-           nd=iclus[i];
-           ndig=(Float_t) nd;
-           Int_t count=0;
-           for (k=min;k<min+nd;k++){
-               xpad[count] = digx[k];     
-               zpad[count] = digz[k];
-
-               tr1pad[count] = digtr1[k];         
-               tr2pad[count] = digtr2[k];         
-               tr3pad[count] = digtr3[k];         
-               tr4pad[count] = digtr4[k];         
-
-               count++; 
-           } // end for k
-           ndxmin = xpad[TMath::LocMin(nd,xpad)];
-           ndxmax = xpad[TMath::LocMax(nd,xpad)];
-           ndzmin = zpad[TMath::LocMin(nd,zpad)];
-           ndzmax = zpad[TMath::LocMax(nd,zpad)];
-           ndx = ndxmax - ndxmin+1;
-           ndz = ndzmax - ndzmin+1;
-
-           // calculate x and z coordinates of the center of the cluster
-           fSegmentation->GetPadCxz(digx[min],digz[min]-1,xdum, zdum);
-
-           if (ndx == 1) {
-               xcenter[i] = xdum;
-           }else{ 
-               xcenter[i] = 0.;
-               for (k=0;k<nd;k++) {
-                   fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
-                   xcenter[i] += (xdum / nd);
-               } // end for k               
-           } // end if ndx
-
-           if (ndz == 1) {
-               zcenter[i] = zdum;
-           } else {
-               zcenter[i] = 0.;
-               for (k=0;k<nd;k++) {          
-                   fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
-                   zcenter[i] += (zdum / nd);
-               } // end for k
-           } // end if ndz
-
-           // error on points in x and z directions
+        min = max;
+        max += iclus[i];
+        deltax = GetSeg()->Dpx(0);
+        if (iclus[i]!=1){
+            //cluster with more than one digit
+            nd=iclus[i];
+            ndig=(Double_t) nd;
+            Int_t count=0;
+            for (k=min;k<min+nd;k++){
+                xpad[count] = digx[k];    
+                zpad[count] = digz[k];
 
-           if (ndx == 1) {
-               errxcenter[i] = deltax / TMath::Sqrt(12.);
-           } else {
-               errxcenter[i] = 0.;                     
-               for (k=0;k<nd;k++){ 
-                   fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
-                   errxcenter[i] += ((xdum-xcenter[i])*(xdum-xcenter[i]))/
-                                    (nd*(nd-1)); 
-               } // end for k
-               errxcenter[i] = TMath::Sqrt(errxcenter[i]);
-           } // end if ndx     
-           if (ndz == 1) {
-               deltaz = fSegmentation->Dpz(digz[min]);               
-               errzcenter[i] = deltaz / TMath::Sqrt(12.);
-           } else {
-               errzcenter[i] = 0.;
-               for (k=0;k<nd;k++){ 
-                   fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
-                   errzcenter[i] += ((zdum-zcenter[i])*(zdum-zcenter[i]))/
-                                    (nd*(nd-1));
-               } // end for k
-               errzcenter[i] = TMath::Sqrt(errzcenter[i]);
-           } // end if ndz
-           // take three track numbers for the cluster
-           // choose the track numbers of the digit with higher signal 
-           kmax = 0;
-           sigmax = 0;
-           for (k=0;k<nd;k++){
-               if(tr4pad[k] > sigmax){
-                   sigmax = tr4pad[k];
-                   kmax   = k;
-               } // end if tr4pad[k]
-           } // end for k
-           if(sigmax != 0) {
-               tr1clus[i]= tr1pad[kmax];
-               tr2clus[i]= tr2pad[kmax];
-               tr3clus[i]= tr3pad[kmax];
-           } else {
-               tr1clus[i]= -2;
-               tr2clus[i]= -2;
-               tr3clus[i]= -2;
-           } // end if sigmax
-       } else {
-           // cluster with single digit
-           ndig= 1.;
-           ndx = 1;
-           ndz = 1;
-           fSegmentation->GetPadCxz(digx[min],digz[min]-1,xdum,zdum);
-           xcenter[i] = xdum;
-           zcenter[i] = zdum;
-           tr1clus[i]=digtr1[min];
-           tr2clus[i]=digtr2[min];
-           tr3clus[i]=digtr3[min];
-           deltaz = fSegmentation->Dpz(digz[min]);
-           errxcenter[i] = deltax / TMath::Sqrt(12.);
-           errzcenter[i] = deltaz / TMath::Sqrt(12.);
-       } // end if iclus[i]
+                tr1pad[count] = digtr1[k];        
+                tr2pad[count] = digtr2[k];        
+                tr3pad[count] = digtr3[k];        
+                tr4pad[count] = digtr4[k];        
+                
+                count++; 
+            } // end for k
+            ndxmin = xpad[TMath::LocMin(nd,xpad)];
+            ndxmax = xpad[TMath::LocMax(nd,xpad)];
+            ndzmin = zpad[TMath::LocMin(nd,zpad)];
+            ndzmax = zpad[TMath::LocMax(nd,zpad)];
+            ndx = ndxmax - ndxmin+1;
+            ndz = ndzmax - ndzmin+1;
+            
+            // calculate x and z coordinates of the center of the cluster
+            GetSeg()->GetPadCxz(digx[min],digz[min]-1,xdum, zdum);
+            
+            if (ndx == 1) {
+                xcenter[i] = xdum;
+            }else{ 
+                xcenter[i] = 0.;
+                for (k=0;k<nd;k++) {
+                    GetSeg()->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
+                    xcenter[i] += (xdum / nd);
+                } // end for k               
+            } // end if ndx
+            
+            if (ndz == 1) {
+                zcenter[i] = zdum;
+            } else {
+                zcenter[i] = 0.;
+                for (k=0;k<nd;k++) {         
+                    GetSeg()->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
+                    zcenter[i] += (zdum / nd);
+                } // end for k
+            } // end if ndz
+            
+            // error on points in x and z directions
+            
+            if (ndx == 1) {
+                errxcenter[i] = deltax / TMath::Sqrt(12.);
+            } else {
+                errxcenter[i] = 0.;                    
+                for (k=0;k<nd;k++){ 
+                    GetSeg()->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
+                    errxcenter[i] += ((xdum-xcenter[i])*(xdum-xcenter[i]))/
+                        (nd*(nd-1)); 
+                } // end for k
+                errxcenter[i] = TMath::Sqrt(errxcenter[i]);
+            } // end if ndx    
+            if (ndz == 1) {
+                deltaz = GetSeg()->Dpz(digz[min]);                   
+                errzcenter[i] = deltaz / TMath::Sqrt(12.);
+            } else {
+                errzcenter[i] = 0.;
+                for (k=0;k<nd;k++){ 
+                    GetSeg()->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
+                    errzcenter[i] += ((zdum-zcenter[i])*(zdum-zcenter[i]))/
+                        (nd*(nd-1));
+                } // end for k
+                errzcenter[i] = TMath::Sqrt(errzcenter[i]);
+            } // end if ndz
+            // take three track numbers for the cluster
+            // choose the track numbers of the digit with higher signal 
+            kmax = 0;
+            sigmax = 0;
+            for (k=0;k<nd;k++){
+                if(tr4pad[k] > sigmax){
+                    sigmax = tr4pad[k];
+                    kmax   = k;
+                } // end if tr4pad[k]
+            } // end for k
+            if(sigmax != 0) {
+                tr1clus[i]= tr1pad[kmax];
+                tr2clus[i]= tr2pad[kmax];
+                tr3clus[i]= tr3pad[kmax];
+            } else {
+                tr1clus[i]= -2;
+                tr2clus[i]= -2;
+                tr3clus[i]= -2;
+            } // end if sigmax
+        } else {
+            // cluster with single digit
+            ndig= 1.;
+            ndx = 1;
+            ndz = 1;
+            GetSeg()->GetPadCxz(digx[min],digz[min]-1,xdum,zdum);
+            xcenter[i] = xdum;
+            zcenter[i] = zdum;
+            tr1clus[i]=digtr1[min];
+            tr2clus[i]=digtr2[min];
+            tr3clus[i]=digtr3[min];
+            deltaz = GetSeg()->Dpz(digz[min]);
+            errxcenter[i] = deltax / TMath::Sqrt(12.);
+            errzcenter[i] = deltaz / TMath::Sqrt(12.);
+        } // end if iclus[i]
 
-       // store the cluster information to the AliITSRawCLusterSPD object
-       static AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
+        // store the cluster information to the AliITSRawCLusterSPD object
+        static AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
 
-       //put the cluster center in local reference frame of the detector
-       // and in microns
-       xcenter[i] = xcenter[i] - fSegmentation->Dx()/2.; 
-       zcenter[i] = zcenter[i] - fSegmentation->Dz()/2.;
+        //put the cluster center in local reference frame of the detector
+        // and in microns
+        xcenter[i] = xcenter[i] - GetSeg()->Dx()/2.; 
+        zcenter[i] = zcenter[i] - GetSeg()->Dz()/2.;
 
-       AliITSRawClusterSPD *clust = new AliITSRawClusterSPD(zcenter[i], //f
-                                                            xcenter[i], //f
-                                                            ndig, //f
-                                                            ndz,ndx, //ii
-                                                            ndxmin,ndxmax,//ii
-                                                            (Float_t) ndzmin,
-                                                            (Float_t) ndzmax,
-                                                            0,module); //ii
-       iTS->AddCluster(0,clust);
-       delete clust;
+        AliITSRawClusterSPD *clust = new AliITSRawClusterSPD(zcenter[i], //f
+                                                             xcenter[i], //f
+                                                             ndig, //f
+                                                             ndz,ndx, //ii
+                                                             ndxmin,ndxmax,//ii
+                                                             (Double_t) ndzmin,
+                                                             (Double_t) ndzmax,
+                                                             0,GetModule());
+        iTS->AddCluster(0,clust);
+        delete clust;
     }//end loop on clusters   
     delete[] ifpad;
     delete[] xpad ;
@@ -391,28 +408,28 @@ void AliITSClusterFinderSPD::ClusterFinder(Int_t ndigits,Int_t digx[],
 }
 //______________________________________________________----------------
 void AliITSClusterFinderSPD::DigitToPoint(Int_t nclus,
-                                         Float_t *xcenter,Float_t *zcenter,
-                                         Float_t *errxcenter,
-                                         Float_t *errzcenter, 
+                                         Double_t *xcenter,Double_t *zcenter,
+                                         Double_t *errxcenter,
+                                         Double_t *errzcenter, 
                                          Int_t *tr1clus, Int_t *tr2clus,
                                          Int_t *tr3clus){
     // A point is associated to each cluster of SPD digits. The points
     // and their associated errors are stored in the file galiceSP.root.
-    Float_t l[3],xg,zg;
-    const Float_t kconv = 1.0e-4; // micron -> cm
+    Double_t l[3],xg,zg;
+    const Double_t kconv = 1.0e-4; // micron -> cm
 
     // get rec points
     static AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
     for (Int_t i=0; i<nclus; i++){
         l[0] = kconv*xcenter[i];
-        l[1] = kconv*fSegmentation->Dy()/2.;
+        l[1] = kconv*GetSeg()->Dy()/2.;
         l[2] = kconv*zcenter[i];
 
         xg = l[0]; 
         zg = l[2]; 
 
-       Float_t sigma2x = (kconv*errxcenter[i]) * (kconv*errxcenter[i]);
-       Float_t sigma2z = (kconv*errzcenter[i]) * (kconv*errzcenter[i]);
+        Double_t sigma2x = (kconv*errxcenter[i]) * (kconv*errxcenter[i]);
+        Double_t sigma2z = (kconv*errzcenter[i]) * (kconv*errzcenter[i]);
         AliITSRecPoint rnew;
         rnew.SetX(xg);
         rnew.SetZ(zg);
index b202c9c..4f8bcd2 100644 (file)
@@ -8,43 +8,49 @@
 #include "AliITSClusterFinder.h"
 
 class AliITSMapA1;
+class AliITSsegmentation;
+class AliITSsegmentationSPD;
+class AliITSresponse;
+class AliITSresponseSPD;
+class TClonesArray;
 
 class AliITSClusterFinderSPD : public AliITSClusterFinder{
  public:
-    AliITSClusterFinderSPD(AliITSsegmentation *segmentation,
-                          TClonesArray *digits, TClonesArray *recpoints);
     AliITSClusterFinderSPD();
-    virtual ~AliITSClusterFinderSPD(){// destructor
-    }
+    AliITSClusterFinderSPD(AliITSsegmentation *segmentation,
+                           AliITSresponse *res);
+    AliITSClusterFinderSPD(AliITSsegmentation *segmentation,
+                          TClonesArray *digits,TClonesArray *recpoints);
+    virtual ~AliITSClusterFinderSPD(){}// destructor
     // copy constructor
     AliITSClusterFinderSPD(const AliITSClusterFinderSPD &source);
     // assignment operator
     AliITSClusterFinderSPD& operator=(const AliITSClusterFinderSPD &source);
-  
-    virtual void SetDx(Float_t dx=1.) {// set dx
-       fDx=dx;}
-    virtual void SetDz(Float_t dz=0.) {// set dz
-       fDz=dz;}
+
+    virtual AliITSresponseSPD* GetResp()const{
+        return (AliITSresponseSPD*) GetResponse();}//Return Response
+    //Returns fSegmentation
+    virtual AliITSsegmentationSPD* GetSeg()const{
+        return (AliITSsegmentationSPD*)GetSegmentation();}  
+    virtual void SetDx(Double_t dx=1.) {fDx=dx;}// set dx
+    virtual void SetDz(Double_t dz=0.) {fDz=dz;}// set dz
     // Search for clusters
     virtual void FindRawClusters(Int_t module); 
-    void  DigitToPoint(Int_t nclus, Float_t *xcenter, Float_t *zcenter,
-                      Float_t *errxcenter,Float_t *errzcenter,
-                      Int_t *tr1clus, Int_t *tr2clus, Int_t *tr3clus);
+    void  DigitToPoint(Int_t nclus, Double_t *xcenter, Double_t *zcenter,
+                       Double_t *errxcenter,Double_t *errzcenter,
+                       Int_t *tr1clus, Int_t *tr2clus, Int_t *tr3clus);
     void  ClusterFinder(Int_t ndigits,Int_t digx[],Int_t digz[],
-                       Int_t digtr1[],Int_t digtr2[],Int_t digtr3[],
-                       Int_t digtr4[],
-                       Int_t &nclus,
-                       Float_t xcenter[],Float_t zcenter[],
-                       Float_t errxcenter[],Float_t errzcenter[],  
-                       Int_t tr1clus[],Int_t tr2clus[], Int_t tr3clus[],
-                       Int_t module);
- private:
-    TClonesArray       *fClusters;      // clusters
-    Int_t               fNclusters;     // num of clusters
-    Float_t             fDz;            // dz
-    Float_t             fDx;            // dx
+                        Int_t digtr1[],Int_t digtr2[],Int_t digtr3[],
+                        Int_t digtr4[],
+                        Int_t &nclus,
+                        Double_t xcenter[],Double_t zcenter[],
+                        Double_t errxcenter[],Double_t errzcenter[],  
+                        Int_t tr1clus[],Int_t tr2clus[], Int_t tr3clus[]);
+  private:
+    Double_t             fDz;            // dz
+    Double_t             fDx;            // dx
     Int_t               fMinNCells;     // min num of cells in the cluster
   
-    ClassDef(AliITSClusterFinderSPD,1)  // SPD clustering
+    ClassDef(AliITSClusterFinderSPD,2)  // SPD clustering
 };
 #endif
diff --git a/ITS/AliITSClusterFinderSPDdubna.cxx b/ITS/AliITSClusterFinderSPDdubna.cxx
deleted file mode 100644 (file)
index b380523..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-/**************************************************************************
- * 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.                  *
- **************************************************************************/
-
-/* $Id$ */
-
-//  Cluster Finder for
-//  Silicon
-//  Pixel
-//  developed by the Dubna group
-//
-#include <Riostream.h>
-#include "AliITSClusterFinderSPDdubna.h"
-#include "AliITSMapA1.h"
-#include "AliITS.h"
-#include "AliITSdigitSPD.h"
-#include "AliITSRawClusterSPD.h"
-#include "AliITSRecPoint.h"
-#include "AliITSsegmentation.h"
-#include "AliRun.h"
-
-//#define DEBUG
-
-ClassImp(AliITSClusterFinderSPDdubna)
-
-//----------------------------------------------------------------------
-AliITSClusterFinderSPDdubna::AliITSClusterFinderSPDdubna(
-           AliITSsegmentation *seg, TClonesArray *digits, TClonesArray *recp){
-    // constructor
-
-    fSegmentation = seg;
-    fDigits       = digits;
-    fClusters     = recp;
-    fNclusters    = 0;
-    fMap          = new AliITSMapA1(fSegmentation,fDigits);
-    SetDx();
-    SetDz();
-    SetNCells();
-}
-//_______________________________________________________________________
-AliITSClusterFinderSPDdubna::AliITSClusterFinderSPDdubna(){
-    // constructor
-
-    fSegmentation = 0;
-    fDigits       = 0;
-    fClusters     = 0;
-    fNclusters    = 0;
-    fMap          = 0;
-    SetDx();
-    SetDz();
-    SetNCells();
-}
-//______________________________________________________________________
-AliITSClusterFinderSPDdubna &AliITSClusterFinderSPDdubna::operator=(const
-                                          AliITSClusterFinderSPDdubna &s){
-    // The = operator for the class AliITSClusterFinderSPDdugna
-    // Inputs:
-    //    AliITSClusterFinderSPDdubna @s  The AliITSClusterFinderSPDdubna
-    //                                    class to be copy constructed.
-    // Outputs:
-    //    none.
-    // Returned:
-    //    this, a copy of the class s.
-
-    this->fNclusters = s.fNclusters;
-    this->fDz        = s.fDz;
-    this->fDx        = s.fDx;
-    this->fMinNCells = s.fMinNCells;
-    this->fClusters  = new TClonesArray(*(s.fClusters));
-    return *this;
-}
-//______________________________________________________________________
-AliITSClusterFinderSPDdubna::AliITSClusterFinderSPDdubna(
-      const AliITSClusterFinderSPDdubna &s): AliITSClusterFinder(s){
-    // The Copy constructortor the class AliITSClusterFinderSPDdugna
-    // It calles the = operator.
-    // Inputs:
-    //    AliITSClusterFinderSPDdubna @s  The AliITSClusterFinderSPDdubna
-    //                                    class to be copy constructed.
-    // Outputs:
-    //    none.
-    // Returned:
-    //    none.
-
-    *this = s;
-    return;
-}
-//______________________________________________________________________
-AliITSClusterFinderSPDdubna::~AliITSClusterFinderSPDdubna(){
-    // destructor
-
-    if (fMap) delete fMap;
-}
-//______________________________________________________________________
-void AliITSClusterFinderSPDdubna::Find1DClusters(Int_t mod){
-    // Find one dimensional clusters, i.e.
-    // in r*phi(x) direction for each colunm in z direction
-
-    static AliITS *iTS=(AliITS*)gAlice->GetModule("ITS");
-  
-    // retrieve the parameters 
-    Int_t fNofPixels     = fSegmentation->Npz(); 
-    Int_t fMaxNofSamples = fSegmentation->Npx();
-
-    // read in digits -> do not apply threshold 
-    // signal in fired pixels is always 1
-    fMap->FillMap();
-
-    Int_t nofFoundClusters = 0;
-
-    Int_t k,it,m;
-    for(k=0;k<fNofPixels;k++) {
-       Int_t mmax = 10;  // a size of the window for the cluster finding
-       for(it=0;it<fMaxNofSamples;it++) {
-           Int_t lclx   = 0;
-           Int_t xstart = 0;
-           Int_t xstop  = 0;
-           Int_t id     = 0;
-           Int_t ilcl   = 0;
-           for(m=0;m<mmax;m++) {  // find the cluster inside the window
-               id = it+m;
-               if(id >= fMaxNofSamples) break;    // ! no possible for the fadc
-               if(fMap->TestHit(k,id) == kUnused) {   // start of the cluster
-                   lclx += 1;
-                   if(lclx == 1) xstart = id;
-               } // end if fMap
-               if(lclx > 0 && fMap->TestHit(k,id) == kEmpty) {  
-                   // end of cluster if a gap exists
-                   xstop = id-1;
-                   ilcl = 1;
-                   break;
-               } // end if lclx >0 ...
-           }   //  end of m-loop
-           if(lclx == 0 && ilcl == 0) it = id; // no cluster in the window,
-                                               // continue the "it" loop
-           if(id >= fMaxNofSamples && lclx == 0) break; // the x row finished
-           if(id < fMaxNofSamples && ilcl == 0 && lclx > 0) {  
-               // cluster end is outside of the window,
-               mmax += 5;     // increase mmax and repeat the cluster finding
-               it -= 1;
-           } // end if id<
-           if(id >= fMaxNofSamples && lclx > 0) {  // the x row finished but
-               xstop = fMaxNofSamples - 1;           // the end cluster exists
-               ilcl = 1;
-           }  // end if id>=      
-           // ---  Calculate z and x coordinates for one dimensional clusters
-           if(ilcl == 1) {         // new cluster exists
-               it = id;
-               mmax = 10;
-               nofFoundClusters++;
-               Float_t clusterCharge = 0.;
-               Float_t zpitch        = fSegmentation->Dpz(k+1);
-               Int_t   dummy         = 0;
-               Float_t clusterZ, dummyX; 
-               fSegmentation->GetPadCxz(dummy,k,dummyX,clusterZ);
-               Float_t zstart        = clusterZ - 0.5*zpitch;
-               Float_t zstop         = clusterZ + 0.5*zpitch;
-               Float_t clusterX      = 0.;
-               Int_t   clusterSizeX  = lclx;
-               Int_t   clusterSizeZ  = 1;
-               Int_t   its;
-               for(its=xstart; its<=xstop; its++) {
-                   Int_t firedpixel=0;
-                   if (fMap->GetHitIndex(k,its)>=0) firedpixel=1; 
-                   clusterCharge += firedpixel;
-                   clusterX      += its + 0.5;
-               } // end for its
-               Float_t fRphiPitch = fSegmentation->Dpx(dummy);
-               clusterX /= (clusterSizeX/fRphiPitch); // center of gravity for x
-               // Write the points (coordinates and some cluster information) 
-               // to the AliITSRawClusterSPD object
-
-               AliITSRawClusterSPD clust(clusterZ,clusterX,clusterCharge,
-                                         clusterSizeZ,clusterSizeX,
-                                         xstart,xstop,zstart,zstop,k,mod);
-               iTS->AddCluster(0,&clust);
-           }    // new cluster (ilcl=1)
-       } // X direction loop (it)
-    } // Z direction loop (k)
-    //fMap->ClearMap();
-    return;
-}
-//______________________________________________________________________
-void  AliITSClusterFinderSPDdubna::GroupClusters(){
-    // Find two dimensional clusters, i.e. group one dimensional clusters
-    // into two dimensional ones (go both in x and z directions).
-    // get number of clusters for this module
-
-    Int_t nofClusters = fClusters->GetEntriesFast();
-    nofClusters -= fNclusters;
-    AliITSRawClusterSPD *clusterI;
-    AliITSRawClusterSPD *clusterJ;
-    Int_t *label=new Int_t[nofClusters];  
-    Int_t i,j;
-    for(i=0; i<nofClusters; i++) label[i] = 0;
-    for(i=0; i<nofClusters; i++) {
-       if(label[i] != 0) continue;
-       for(j=i+1; j<nofClusters; j++) { 
-           if(label[j] != 0) continue;
-           clusterI = (AliITSRawClusterSPD*) fClusters->At(i);
-           clusterJ = (AliITSRawClusterSPD*) fClusters->At(j);
-           Bool_t pair = clusterI->Brother(clusterJ,fDz,fDx);
-           if(pair) {
-#ifndef DEBUG
-               cout << "clusters " << i << "," << j << " before grouping" << endl;
-               clusterI->PrintInfo();
-               clusterJ->PrintInfo();
-#endif
-               clusterI->Add(clusterJ);
-#ifndef DEBUG
-               cout << "remove cluster " << j << endl;
-#endif
-               label[j] = 1;
-               fClusters->RemoveAt(j);
-#ifndef DEBUG
-               cout << "cluster  " << i << " after grouping" << endl;
-               clusterI->PrintInfo();
-#endif
-           }  // pair
-       } // J clusters  
-       label[i] = 1;
-    } // I clusters
-    fClusters->Compress();
-#ifndef DEBUG
-    Int_t totalNofClusters = fClusters->GetEntriesFast();
-    cout << " Nomber of clusters at the group end ="<< totalNofClusters<<endl;
-#endif
-    delete [] label;
-    return;
-}
-//______________________________________________________________________
-void AliITSClusterFinderSPDdubna::TracksInCluster(){
-    // Find tracks creating one cluster
-    // get number of clusters for this module
-    Int_t nofClusters = fClusters->GetEntriesFast();
-    Int_t i, ix, iz, jx, jz, xstart, xstop, zstart, zstop, nclx, nclz;
-    const Int_t kTrmax = 100;
-    Int_t cltracks[kTrmax], itr, tracki, ii, is, js, ie, ntr, tr0, tr1, tr2;
-
-    nofClusters -= fNclusters;
-    for(i=0; i<nofClusters; i++) { 
-       ii = 0;
-       memset(cltracks,-1,sizeof(int)*kTrmax);
-       tr0=tr1=tr2=-1;
-       AliITSRawClusterSPD *clusterI = (AliITSRawClusterSPD*) fClusters->At(i);
-       nclx = clusterI->NclX();
-       nclz = clusterI->NclZ();
-       xstart = clusterI->XStartf();
-       xstop = clusterI->XStopf();
-       zstart = clusterI->Zend()-nclz+1;
-       zstop = clusterI->Zend();
-       Int_t ind;
-       for(iz=0; iz<nclz; iz++) { 
-           jz = zstart + iz;
-           for(ix=0; ix<nclx; ix++) { 
-               jx = xstart + ix;
-               ind = fMap->GetHitIndex(jz,jx);
-               if(ind < 0) continue;
-               if(ind == 0 && iz >= 0 && ix > 0) continue;
-               if(ind == 0 && iz > 0 && ix >= 0) continue;
-               if(ind == 0 && iz == 0 && ix == 0 && i > 0) continue;
-               AliITSdigitSPD *dig = (AliITSdigitSPD*)fMap->GetHit(jz,jx);
-               for(itr=0; itr<3; itr++) { 
-                   tracki = dig->GetTrack(i);
-                   if(tracki >= 0) {
-                       ii += 1;
-                       if(ii < 99) cltracks[ii-1] = tracki;
-                   } // end if tracki >-0
-               } // end for itr
-           } // ix pixel
-       }  // iz pixel
-       for(is=0; is<kTrmax; is++) { 
-           if(cltracks[is]<0) continue;
-           for(js=is+1; js<kTrmax; js++) { 
-               if(cltracks[js]<0) continue;
-               if(cltracks[js]==cltracks[is]) cltracks[js]=-5;
-           } // end for js
-       } // end for is
-       ntr = 0;
-       for(ie=0; ie<kTrmax; ie++) { 
-           if(cltracks[ie] >= 0) {
-               ntr=ntr+1;
-               if(ntr==1) tr0=cltracks[ie];
-               if(ntr==2) tr1=cltracks[ie];
-               if(ntr==3) tr2=cltracks[ie];
-           } // end if cltracks[ie] >-=
-       } // end for ie
-       // if delta ray only
-       if(ntr == 0) ntr = 1;
-       clusterI->SetNTracks(ntr);
-       clusterI->SetTracks(tr0,tr1,tr2);
-    } // I cluster
-}
-//______________________________________________________________________
-void AliITSClusterFinderSPDdubna::GetRecPoints(){
-    // get rec points
-    static AliITS *iTS = (AliITS*)gAlice->GetModule("ITS");
-    // get number of clusters for this module
-    Int_t nofClusters   = fClusters->GetEntriesFast();
-    const Float_t kconv = 1.0e-4;
-    const Float_t kRMSx = 12.0*kconv; // microns -> cm ITS TDR Table 1.3
-    const Float_t kRMSz = 70.0*kconv; // microns -> cm ITS TDR Table 1.3
-    Float_t spdLength   = fSegmentation->Dz();
-    Float_t spdWidth    = fSegmentation->Dx();
-    Int_t   dummy       = 0;
-    Float_t xpitch      = fSegmentation->Dpx(dummy);
-    Int_t i;
-    Int_t track0, track1, track2;
-
-    nofClusters -= fNclusters;
-    for(i=0; i<nofClusters; i++) {
-       AliITSRawClusterSPD *clusterI = (AliITSRawClusterSPD*) fClusters->At(i);
-       Int_t clustersizex = clusterI->NclX();
-       Int_t clustersizez = clusterI->NclZ();
-       Int_t xstart = clusterI->XStartf();
-       Float_t clusterx = 0;
-       Float_t clusterz = clusterI->Z();
-       for(Int_t ii=0; ii<clustersizex; ii++) clusterx += (xstart+0.5+ii)*xpitch;
-       clusterx /= clustersizex;
-       clusterz /= clustersizez;   
-       clusterI->GetTracks(track0, track1, track2); 
-       AliITSRecPoint rnew;
-       rnew.SetX((clusterx - spdWidth/2)*kconv);
-       rnew.SetZ((clusterz - spdLength/2)*kconv);
-       rnew.SetQ(1.);
-       rnew.SetdEdX(0.);
-       rnew.SetSigmaX2(kRMSx*kRMSx);
-       rnew.SetSigmaZ2(kRMSz*kRMSz);
-       rnew.fTracks[0]=track0;
-       rnew.fTracks[1]=track1;
-       rnew.fTracks[2]=track2;
-       iTS->AddRecPoint(rnew);
-    } // I clusters
-    fMap->ClearMap();
-}
-//______________________________________________________________________
-void AliITSClusterFinderSPDdubna::FindRawClusters(Int_t mod){
-    // find raw clusters
-
-#ifndef DEBUG
-    cout<<"SPDdubna: module ="<<mod<<endl;
-#endif
-    Find1DClusters(mod);
-    GroupClusters();
-    TracksInCluster();
-    GetRecPoints();
-}
diff --git a/ITS/AliITSClusterFinderSPDdubna.h b/ITS/AliITSClusterFinderSPDdubna.h
deleted file mode 100644 (file)
index 3bdc9e3..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef ALIITSCLUSTERFINDERSPDDUBNA_H
-#define ALIITSCLUSTERFINDERSPDDUBNA_H
-
-////////////////////////////////////////////////
-//  ITS Cluster Finder Class                 //
-////////////////////////////////////////////////
-
-#include "AliITSClusterFinder.h"
-
-class AliITSMapA1;
-class AliITSClusterFinderSPDdubna : public AliITSClusterFinder{
- public:
-    AliITSClusterFinderSPDdubna(AliITSsegmentation *seg,TClonesArray *dig,
-                               TClonesArray *recp);
-    AliITSClusterFinderSPDdubna();
-    virtual ~AliITSClusterFinderSPDdubna();
-    // copy ctor
-    AliITSClusterFinderSPDdubna(const AliITSClusterFinderSPDdubna &source);
-    // = opperator
-    AliITSClusterFinderSPDdubna& operator=(const AliITSClusterFinderSPDdubna
-                                          &source);
-
-    void SetDx(Float_t dx=1.) {// set dx
-       fDx=dx;}
-    void SetDz(Float_t dz=0.) {// set dz
-       fDz=dz;}
-    void SetNCells(Int_t minc=0) {// set ncells
-       fMinNCells=minc;}
-
-    // Search for clusters
-    void FindRawClusters(Int_t mod=0);
-    void Find1DClusters(Int_t mod);
-    void GroupClusters();
-    void TracksInCluster();
-    void SelectClusters() {// selects clusters
-    }
-    void  GetRecPoints();
- private:
-    TClonesArray       *fClusters;      // clusters
-    Int_t               fNclusters;     // num of clusters
-    Float_t             fDz;            // dz
-    Float_t             fDx;            // dx
-    Int_t               fMinNCells;     // min num of cells in the cluster
-  
-    ClassDef(AliITSClusterFinderSPDdubna,1)  // SPD clustering - Boris B.
-                                            // algo based on Piergiorgio's
-                                            // algo
-};
-#endif
index 61a1c0d..9a4ba32 100644 (file)
 #include "AliITSClusterFinderSSD.h"
 #include "AliITSclusterSSD.h"
 #include "AliITSpackageSSD.h"
-#include "AliITSsegmentation.h"
+#include "AliITSresponseSSD.h"
+#include "AliITSsegmentationSSD.h"
 #include "AliITSgeom.h"
 
 const Bool_t AliITSClusterFinderSSD::fgkSIDEP=kTRUE;
 const Bool_t AliITSClusterFinderSSD::fgkSIDEN=kFALSE;
-const Int_t debug=0;
 
 ClassImp(AliITSClusterFinderSSD)
 
@@ -42,34 +42,89 @@ ClassImp(AliITSClusterFinderSSD)
 //
 //  Constructor
 //______________________________________________________________________
-AliITSClusterFinderSSD::AliITSClusterFinderSSD(){
+AliITSClusterFinderSSD::AliITSClusterFinderSSD():
+AliITSClusterFinder(),
+fITS(0),
+fClusterP(0),
+fNClusterP(0),
+fClusterN(0),
+fNClusterN(0),
+fPackages(0),
+fNPackages(0),
+fDigitsIndexP(0),
+fNDigitsP(0),
+fDigitsIndexN(0),
+fNDigitsN(0),
+fPitch(0.0),
+fTanP(0.0),
+fTanN(0.0),
+fPNsignalRatio(0.0),
+fSFF(0),
+fSFB(0){
     //Default constructor
+}
+//______________________________________________________________________
+AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSsegmentation *seg,
+                                               TClonesArray *digits):
+AliITSClusterFinder(seg,0),
+fITS(0),
+fClusterP(0),
+fNClusterP(0),
+fClusterN(0),
+fNClusterN(0),
+fPackages(0),
+fNPackages(0),
+fDigitsIndexP(0),
+fNDigitsP(0),
+fDigitsIndexN(0),
+fNDigitsN(0),
+fPitch(0.0),
+fTanP(0.0),
+fTanN(0.0),
+fPNsignalRatio(0.0),
+fSFF(0),
+fSFB(0){
+    //Standard constructor
 
-    fSegmentation = 0;
-    fDigits       = 0;
-    fMap          = 0;
-    fITS = (AliITS*)gAlice->GetModule("ITS");
-    fClusterP     = 0;    
-    fNClusterP    =0;
-    fClusterN     = 0;
+    SetDigits(digits);
+    SetMap(new AliITSMapA1(GetSeg(),Digits()));
+    fITS          = (AliITS*)gAlice->GetModule("ITS");
+    fClusterP     = new TClonesArray ("AliITSclusterSSD",200);    
+    fNClusterP    = 0;
+    fClusterN     = new TClonesArray ("AliITSclusterSSD",200);   
     fNClusterN    = 0;
-    fPackages     = 0;
+    fPackages     = new TClonesArray ("AliITSpackageSSD",200);    //packages  
     fNPackages    = 0;
-    fDigitsIndexP = 0;
+    fDigitsIndexP = new TArrayI(300);
     fNDigitsP     = 0;
-    fDigitsIndexN = 0;
+    fDigitsIndexN = new TArrayI(300);
     fNDigitsN     = 0;
-    fPitch        = 0;
-    fPNsignalRatio= 0;
+    fPitch        = GetSeg()->Dpx(0);
+    fPNsignalRatio= 7./8.;    // warning: hard-wired number
 }
 //______________________________________________________________________}
 AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSsegmentation *seg,
-                                              TClonesArray *digits){
+                                               AliITSresponse *res):
+AliITSClusterFinder(seg,res),
+fITS(0),
+fClusterP(0),
+fNClusterP(0),
+fClusterN(0),
+fNClusterN(0),
+fPackages(0),
+fNPackages(0),
+fDigitsIndexP(0),
+fNDigitsP(0),
+fDigitsIndexN(0),
+fNDigitsN(0),
+fPitch(0.0),
+fTanP(0.0),
+fTanN(0.0),
+fPNsignalRatio(0.0),
+fSFF(0),
+fSFB(0){
     //Standard constructor
 
-    fSegmentation = seg;
-    fDigits       = digits;
-    fMap          = new AliITSMapA1(fSegmentation,fDigits);
     fITS          = (AliITS*)gAlice->GetModule("ITS");
     fClusterP     = new TClonesArray ("AliITSclusterSSD",200);    
     fNClusterP    = 0;
@@ -81,19 +136,19 @@ AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSsegmentation *seg,
     fNDigitsP     = 0;
     fDigitsIndexN = new TArrayI(300);
     fNDigitsN     = 0;
-    fPitch        = fSegmentation->Dpx(0);
+    fPitch        = GetSeg()->Dpx(0);
     fPNsignalRatio= 7./8.;    // warning: hard-wired number
 }
 //______________________________________________________________________
 AliITSClusterFinderSSD::~AliITSClusterFinderSSD(){
     // Default destructor
 
+    fITS = 0;
     delete fClusterP;
     delete fClusterN;        
     delete fPackages;        
     delete fDigitsIndexP;        
     delete fDigitsIndexN; 
-    delete fMap;
 }
 //______________________________________________________________________
 void AliITSClusterFinderSSD::InitReconstruction(){
@@ -110,9 +165,9 @@ void AliITSClusterFinderSSD::InitReconstruction(){
     fNDigitsP  = 0;
     fNDigitsN  = 0;
     Float_t stereoP,stereoN;
-    fSegmentation->Angles(stereoP,stereoN);
+    GetSeg()->Angles(stereoP,stereoN);
     CalcStepFactor(stereoP,stereoN);
-    if (debug) cout<<"fSFF = "<<fSFF<<"  fSFB = "<<fSFB<<"\n";
+    if(GetDebug(1)) cout<<"fSFF = "<<fSFF<<"  fSFB = "<<fSFB<<"\n";
 }
 //______________________________________________________________________
 void AliITSClusterFinderSSD::FindRawClusters(Int_t module){
@@ -125,18 +180,19 @@ void AliITSClusterFinderSSD::FindRawClusters(Int_t module){
     Int_t lay, lad, detect;
     AliITSgeom *geom = fITS->GetITSgeom();
 
-    geom->GetModuleId(module,lay, lad, detect);
-    if ( lay == 6 ) ((AliITSsegmentationSSD*)fSegmentation)->SetLayer(6);
-    if ( lay == 5 ) ((AliITSsegmentationSSD*)fSegmentation)->SetLayer(5);
+    SetModule(module);
+    geom->GetModuleId(GetModule(),lay, lad, detect);
+    if ( lay == 6 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(6);
+    if ( lay == 5 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(5);
 
     InitReconstruction();  //ad. 1
-    fMap->FillMap();
+    Map()->FillMap();
     FillDigitsIndex();
     SortDigits();
     FindNeighbouringDigits(); //ad. 2
     //SeparateOverlappedClusters();  //ad. 3
     ClustersToPackages();  //ad. 4
-    fMap->ClearMap();
+    Map()->ClearMap();
 }
 //______________________________________________________________________
 void AliITSClusterFinderSSD::FindNeighbouringDigits(){
@@ -185,30 +241,30 @@ void AliITSClusterFinderSSD::FindNeighbouringDigits(){
            currentstripNo = ((AliITSdigitSSD*)(lDigits[lDigitsIndexN[i]]))->
                                                             GetStripNumber();
            if ( (((AliITSdigitSSD*)lDigits[lDigitsIndexN[i-1]])->
-                                                              GetStripNumber()) 
+                                                            GetStripNumber()) 
                 == (currentstripNo-1) ) dbuffer[dnumber++]=lDigitsIndexN[i];
            else {
                new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,
-                                                             Digits(),
-                                                             fgkSIDEN);
+                                                        Digits(),
+                                                        fgkSIDEN);
                dbuffer[0]=lDigitsIndexN[i];
                dnumber = 1;
            } // end if else
        } // end loop over fNDigitsN
        new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,
-                                                     Digits(),fgkSIDEN);
+                                                   Digits(),fgkSIDEN);
        delete [] dbuffer;
 
     } // end condition on  NDigits 
 
-    if (debug) cout<<"\n Found clusters: fNClusterP = "<<fNClusterP
+    if (GetDebug(1)) cout<<"\n Found clusters: fNClusterP = "<<fNClusterP
                   <<"  fNClusterN ="<<fNClusterN<<"\n";
 }
 //______________________________________________________________________
 void AliITSClusterFinderSSD::SeparateOverlappedClusters(){
     // overlapped clusters separation
     register Int_t i; //iterator
-    Float_t  factor=0.75;            // How many percent must be lower signal 
+    Double_t  factor=0.75;            // How many percent must be lower signal 
                                      // on the middle one digit
                                      // from its neighbours
     Int_t    signal0;              //signal on the strip before the current one
@@ -344,20 +400,20 @@ Int_t AliITSClusterFinderSSD::SortDigitsN(Int_t start, Int_t end){
     Int_t left;
 
     if (start != (end - 1)){
-       left=this->SortDigitsN(start,(start+end)/2);
-       right=this->SortDigitsN((start+end)/2,end);  
-       return (left || right);
+        left=this->SortDigitsN(start,(start+end)/2);
+        right=this->SortDigitsN((start+end)/2,end);  
+        return (left || right);
     }else{
-       left =((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[start]]))->
-                                                              GetStripNumber();
-       right=((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[end]]))->
-                                                              GetStripNumber();
-       if ( left > right ){
-           Int_t tmp = (*fDigitsIndexN)[start];
-           (*fDigitsIndexN)[start]=(*fDigitsIndexN)[end];
-           (*fDigitsIndexN)[end]=tmp;
-           return 1;
-       }else return 0;
+        left =((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[start]]))->
+            GetStripNumber();
+        right=((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[end]]))->
+            GetStripNumber();
+        if ( left > right ){
+            Int_t tmp = (*fDigitsIndexN)[start];
+            (*fDigitsIndexN)[start]=(*fDigitsIndexN)[end];
+            (*fDigitsIndexN)[end]=tmp;
+            return 1;
+        }else return 0;
     } // end if
 }
 //______________________________________________________________________
@@ -368,7 +424,7 @@ void AliITSClusterFinderSSD::FillDigitsIndex(){
     Int_t noentries;
     Int_t i;
 
-    noentries = fDigits->GetEntriesFast();
+    noentries = NDigits();
 
     Int_t* psidx = new Int_t [noentries*sizeof(Int_t)];
     Int_t* nsidx = new Int_t [noentries*sizeof(Int_t)]; 
@@ -378,45 +434,45 @@ void AliITSClusterFinderSSD::FillDigitsIndex(){
     AliITSdigitSSD *dig;
 
     for ( i = 0 ; i< noentries; i++ ) {
-       dig = (AliITSdigitSSD*)GetDigit(i);
-       if(dig->IsSideP()) { 
-           bit=1;
-           tmp=dig->GetStripNumber();
-           // I find this totally unnecessary - it's just a 
-           // CPU consuming double check
-           for( k=0;k<pns;k++){
-               if (tmp==psidx[k]){
-                   if (debug) cout<<"Such a digit exists \n";
-                   bit=0;
-               } // end if
-           } // end for k
-           // end comment 
-           if(bit) {
-               fDigitsIndexP->AddAt(i,fNDigitsP++);
-               psidx[pns++]=tmp;
-           } // end if bit
-       } else {
-           bit=1;
-           tmp=dig->GetStripNumber();
-           // same as above
-           for( k=0;k<nns;k++){
-               if (tmp==nsidx[k]){
-                   if (debug) cout<<"Such a digit exists \n";
-                   bit=0;
-               } // end if
-           } // for k
-           // end comment
-           if (bit) {
-               fDigitsIndexN->AddAt(i,fNDigitsN++);
-               nsidx[nns++] =tmp;
-           } // end if bit
-       } // end if
+        dig = (AliITSdigitSSD*)GetDigit(i);
+        if(dig->IsSideP()) { 
+            bit=1;
+            tmp=dig->GetStripNumber();
+            // I find this totally unnecessary - it's just a 
+            // CPU consuming double check
+            for( k=0;k<pns;k++){
+                if (tmp==psidx[k]){
+                    if (GetDebug(1)) cout<<"Such a digit exists \n";
+                    bit=0;
+                } // end if
+            } // end for k
+            // end comment 
+            if(bit) {
+                fDigitsIndexP->AddAt(i,fNDigitsP++);
+                psidx[pns++]=tmp;
+            } // end if bit
+        } else {
+            bit=1;
+            tmp=dig->GetStripNumber();
+            // same as above
+            for( k=0;k<nns;k++){
+                if (tmp==nsidx[k]){
+                    if (GetDebug(1)) cout<<"Such a digit exists \n";
+                    bit=0;
+                } // end if
+            } // for k
+            // end comment
+            if (bit) {
+                fDigitsIndexN->AddAt(i,fNDigitsN++);
+                nsidx[nns++] =tmp;
+            } // end if bit
+        } // end if
     } // end for i
 
     delete [] psidx;
     delete [] nsidx;
 
-    if (debug) cout<<"Digits :  P = "<<fNDigitsP<<"   N = "<<fNDigitsN<<endl;
+    if(GetDebug(1)) cout<<"Digits: P = "<<fNDigitsP<<" N = "<<fNDigitsN<<endl;
 }
 //______________________________________________________________________
 void AliITSClusterFinderSSD::SortDigits(){
@@ -424,12 +480,13 @@ void AliITSClusterFinderSSD::SortDigits(){
     Int_t i;
 
     if(fNDigitsP>1) for (i=0;i<fNDigitsP-1;i++)
-       if (SortDigitsP(0,(fNDigitsP-1-i))==0) break;
+        if (SortDigitsP(0,(fNDigitsP-1-i))==0) break;
     if(fNDigitsN>1) for (i=0;i<fNDigitsN-1;i++)
-       if(SortDigitsN(0,(fNDigitsN-1-i))==0) break;
+        if(SortDigitsN(0,(fNDigitsN-1-i))==0) break;
 }
 //______________________________________________________________________
-void AliITSClusterFinderSSD::FillClIndexArrays(Int_t* arrayP, Int_t *arrayN) const{
+void AliITSClusterFinderSSD::FillClIndexArrays(Int_t* arrayP,Int_t *arrayN)
+    const{
     // fill cluster index array
     register Int_t i;
 
@@ -442,9 +499,9 @@ void AliITSClusterFinderSSD::SortClusters(Int_t* arrayP, Int_t *arrayN){
     Int_t i;
 
     if(fNClusterP>1) for (i=0;i<fNClusterP-1;i++)
-       if (SortClustersP(0,(fNClusterP-1),arrayP)==0)  break;
-  if(fNClusterN>1) for (i=0;i<fNClusterN-1;i++)
-      if (SortClustersN(0,(fNClusterN-1),arrayN)==0)  break;
+        if (SortClustersP(0,(fNClusterP-1),arrayP)==0)  break;
+    if(fNClusterN>1) for (i=0;i<fNClusterN-1;i++)
+        if (SortClustersN(0,(fNClusterN-1),arrayN)==0)  break;
 }
 //______________________________________________________________________
 Int_t AliITSClusterFinderSSD::SortClustersP(Int_t start, Int_t end,
@@ -454,44 +511,44 @@ Int_t AliITSClusterFinderSSD::SortClustersP(Int_t start, Int_t end,
     Int_t left;
 
     if (start != (end - 1) ) {
-       left=this->SortClustersP(start,(start+end)/2,array);
-       right=this->SortClustersP((start+end)/2,end,array);  
-       return (left || right);
+        left=this->SortClustersP(start,(start+end)/2,array);
+        right=this->SortClustersP((start+end)/2,end,array);  
+        return (left || right);
     } else {
-       left =((AliITSclusterSSD*)((*fClusterP)[array[start]]))->
-                                                         GetDigitStripNo(0);
-       right=((AliITSclusterSSD*)((*fClusterP)[array[ end ]]))->
-                                                         GetDigitStripNo(0);
-       if(left>right) {
-           Int_t tmp = array[start];
-           array[start]=array[end];
-           array[end]=tmp;
-           return 1;
-       } else return 0;
+        left =((AliITSclusterSSD*)((*fClusterP)[array[start]]))->
+            GetDigitStripNo(0);
+        right=((AliITSclusterSSD*)((*fClusterP)[array[ end ]]))->
+            GetDigitStripNo(0);
+        if(left>right) {
+            Int_t tmp = array[start];
+            array[start]=array[end];
+            array[end]=tmp;
+            return 1;
+        } else return 0;
     } // end if
 }
 //______________________________________________________________________
 Int_t AliITSClusterFinderSSD::SortClustersN(Int_t start, Int_t end, 
-                                           Int_t *array){
+                                            Int_t *array){
     //Sort N side clusters
     Int_t right;
     Int_t left;
 
     if (start != (end - 1) ) {
-       left=this->SortClustersN(start,(start+end)/2,array);
-       right=this->SortClustersN((start+end)/2,end,array);  
-       return (left || right);
+        left=this->SortClustersN(start,(start+end)/2,array);
+        right=this->SortClustersN((start+end)/2,end,array);  
+        return (left || right);
     } else {
-       left =((AliITSclusterSSD*)((*fClusterN)[array[start]]))->
-                                                         GetDigitStripNo(0);
-       right=((AliITSclusterSSD*)((*fClusterN)[array[ end ]]))->
-                                                         GetDigitStripNo(0);
-       if( left > right) {
-           Int_t tmp = array[start];
-           array[start]=array[end];
-           array[end]=tmp;
-           return 1;
-       } else return 0;
+        left =((AliITSclusterSSD*)((*fClusterN)[array[start]]))->
+            GetDigitStripNo(0);
+        right=((AliITSclusterSSD*)((*fClusterN)[array[ end ]]))->
+            GetDigitStripNo(0);
+        if( left > right) {
+            Int_t tmp = array[start];
+            array[start]=array[end];
+            array[end]=tmp;
+            return 1;
+        } else return 0;
     } // end if
 }
 //______________________________________________________________________
@@ -524,13 +581,13 @@ void AliITSClusterFinderSSD::ClustersToPackages(){
     for (j1=0;j1<fNClusterP;j1++) {  
        currentP = GetPSideCluster(oneSclP[j1]);
        Double_t xP = currentP->GetPosition();
-       Float_t signalP = currentP->GetTotalSignal();
+       Double_t signalP = currentP->GetTotalSignal();
        for (j2=0;j2<fNClusterN;j2++) {  
            currentN = GetNSideCluster(oneSclN[j2]);
            Double_t xN = currentN->GetPosition();
-           Float_t signalN = currentN->GetTotalSignal();
+           Double_t signalN = currentN->GetTotalSignal();
            CreateNewRecPoint(xP,1,xN,1,signalP,signalN,currentP,currentN,
-                             0.75);
+                           0.75);
        } // end for j2
     } // end for j1
 
@@ -538,67 +595,67 @@ void AliITSClusterFinderSSD::ClustersToPackages(){
     delete [] oneSclN;
 }
 //______________________________________________________________________
-Bool_t AliITSClusterFinderSSD::CreateNewRecPoint(Float_t P,Float_t dP,
-                                                Float_t N, Float_t dN,
-                                                Float_t SigP,Float_t SigN, 
+Bool_t AliITSClusterFinderSSD::CreateNewRecPoint(Double_t P,Double_t dP,
+                                                Double_t N, Double_t dN,
+                                                Double_t SigP,Double_t SigN, 
                                                 AliITSclusterSSD *clusterP,
                                                 AliITSclusterSSD *clusterN,
                                                 Stat_t prob){
     // create the recpoints
-    const Float_t kADCtoKeV = 2.16; 
+    const Double_t kADCtoKeV = 2.16; 
     // 50 ADC units -> 30000 e-h pairs; 1e-h pair -> 3.6e-3 KeV;
     // 1 ADC unit -> (30000/50)*3.6e-3 = 2.16 KeV 
-    const Float_t kconv = 1.0e-4;
-    const Float_t kRMSx = 20.0*kconv; 
-    const Float_t kRMSz = 800.0*kconv;
+    const Double_t kconv = 1.0e-4;
+    const Double_t kRMSx = 20.0*kconv; 
+    const Double_t kRMSz = 800.0*kconv;
     Int_t n=0;
     Int_t *tr;
     Int_t ntracks;
 
     if (GetCrossing(P,N)) {
-       //GetCrossingError(dP,dN);
-       dP = dN = prob = 0.0; // to remove unused variable warning.
-       AliITSRawClusterSSD cnew;
-       Int_t nstripsP=clusterP->GetNumOfDigits();
-       Int_t nstripsN=clusterN->GetNumOfDigits();
-       Float_t signal = 0;
-       Float_t dedx = 0;
-       if(SigP>SigN) {
-           signal = SigP;
-           dedx = SigP*kADCtoKeV;
-       }else{
-           signal = SigN;
-           dedx = SigN*kADCtoKeV;
-       } // end if SigP>SigN
-     tr = (Int_t*) clusterP->GetTracks(n);
-     ntracks = clusterP->GetNTracks();
-     cnew.SetSignalP(SigP);
-     cnew.SetSignalN(SigN);
-     cnew.SetMultiplicity(nstripsP);
-     cnew.SetMultN(nstripsN);
-     cnew.SetQErr(TMath::Abs(SigP-SigN));
-     cnew.SetNTrack(ntracks);
-     fITS->AddCluster(2,&cnew);
-     AliITSRecPoint rnew;
-     rnew.SetX(P*kconv);
-     rnew.SetZ(N*kconv);
-     rnew.SetQ(signal);
-     rnew.SetdEdX(dedx);
-     rnew.SetSigmaX2( kRMSx* kRMSx); 
-     rnew.SetSigmaZ2( kRMSz* kRMSz);
-     rnew.fTracks[0]=tr[0];
-     rnew.fTracks[1]=tr[1];
-     rnew.fTracks[2]=tr[2];
-     fITS->AddRecPoint(rnew);
-     return kTRUE;
+        //GetCrossingError(dP,dN);
+        dP = dN = prob = 0.0; // to remove unused variable warning.
+        AliITSRawClusterSSD cnew;
+        Int_t nstripsP=clusterP->GetNumOfDigits();
+        Int_t nstripsN=clusterN->GetNumOfDigits();
+        Double_t signal = 0;
+        Double_t dedx = 0;
+        if(SigP>SigN) {
+            signal = SigP;
+            dedx = SigP*kADCtoKeV;
+        }else{
+            signal = SigN;
+            dedx = SigN*kADCtoKeV;
+        } // end if SigP>SigN
+        tr = (Int_t*) clusterP->GetTracks(n);
+        ntracks = clusterP->GetNTracks();
+        cnew.SetSignalP(SigP);
+        cnew.SetSignalN(SigN);
+        cnew.SetMultiplicity(nstripsP);
+        cnew.SetMultN(nstripsN);
+        cnew.SetQErr(TMath::Abs(SigP-SigN));
+        cnew.SetNTrack(ntracks);
+        fITS->AddCluster(2,&cnew);
+        AliITSRecPoint rnew;
+        rnew.SetX(P*kconv);
+        rnew.SetZ(N*kconv);
+        rnew.SetQ(signal);
+        rnew.SetdEdX(dedx);
+        rnew.SetSigmaX2( kRMSx* kRMSx); 
+        rnew.SetSigmaZ2( kRMSz* kRMSz);
+        rnew.fTracks[0]=tr[0];
+        rnew.fTracks[1]=tr[1];
+        rnew.fTracks[2]=tr[2];
+        fITS->AddRecPoint(rnew);
+        return kTRUE;
     } // end if
     return kFALSE;  
 }
 //______________________________________________________________________
-void  AliITSClusterFinderSSD::CalcStepFactor(Float_t Psteo, Float_t Nsteo){
+void  AliITSClusterFinderSSD::CalcStepFactor(Double_t Psteo, Double_t Nsteo){
     // calculate the step factor for matching clusters
     // 95 is the pitch, 4000 - dimension along z ?
-    Float_t dz=fSegmentation->Dz();
+    Double_t dz=GetSeg()->Dz();
 
     fSFF = ( (Int_t)  (Psteo*dz/fPitch ) );// +1;
     fSFB = ( (Int_t)  (Nsteo*dz/fPitch ) );// +1;
@@ -608,10 +665,10 @@ AliITSclusterSSD* AliITSClusterFinderSSD::GetPSideCluster(Int_t idx){
     // get P side clusters
 
     if((idx<0)||(idx>=fNClusterP)){
-       printf("AliITSClusterFinderSSD::GetPSideCluster: index out of range\n");
-       return 0;
+        Info("GetPSideCluster","0<index=%d<=%d out of range",idx,fNClusterP);
+        return 0;
     }else{
-       return (AliITSclusterSSD*)((*fClusterP)[idx]);
+        return (AliITSclusterSSD*)((*fClusterP)[idx]);
     } // end if
 }
 //______________________________________________________________________
@@ -619,37 +676,31 @@ AliITSclusterSSD* AliITSClusterFinderSSD::GetNSideCluster(Int_t idx){
     // get N side clusters
 
     if((idx<0)||(idx>=fNClusterN)){
-       printf("AliITSClusterFinderSSD::GetNSideCluster: index out of range\n");
-       return 0;
+        Info("GetNSideCluster","0<index=%d >= %d out of range",idx,fNClusterN);
+        return 0;
     }else{
-       return (AliITSclusterSSD*)((*fClusterN)[idx]);
+        return (AliITSclusterSSD*)((*fClusterN)[idx]);
     } // end if
 }
 //______________________________________________________________________
-AliITSclusterSSD* AliITSClusterFinderSSD::GetCluster(Int_t idx, Bool_t side){
-    // Get cluster
-
-    return (side) ? GetPSideCluster(idx) : GetNSideCluster(idx);
-}
-//______________________________________________________________________
-Bool_t AliITSClusterFinderSSD::GetCrossing (Float_t &P, Float_t &N){ 
+Bool_t AliITSClusterFinderSSD::GetCrossing (Double_t &P, Double_t &N){ 
     // get crossing
     // This function was rivised and changed by Boris Batiounia in March 2001
-    Float_t dx = fSegmentation->Dx(); // detector size in x direction, microns
-    Float_t dz = fSegmentation->Dz(); // detector size in z direction, microns
-    Float_t xL; // x local coordinate
-    Float_t zL; // z local coordinate
-    Float_t x;  // x = xL + dx/2
-    Float_t z;  // z = zL + dz/2
-    Float_t xP; // x coordinate in the P side from the first P strip
-    Float_t xN; // x coordinate in the N side from the first N strip
+    Double_t dx = GetSeg()->Dx(); // detector size in x direction, microns
+    Double_t dz = GetSeg()->Dz(); // detector size in z direction, microns
+    Double_t xL; // x local coordinate
+    Double_t zL; // z local coordinate
+    Double_t x;  // x = xL + dx/2
+    Double_t z;  // z = zL + dz/2
+    Double_t xP; // x coordinate in the P side from the first P strip
+    Double_t xN; // x coordinate in the N side from the first N strip
     Float_t stereoP,stereoN;
 
-    fSegmentation->Angles(stereoP,stereoN);
+    GetSeg()->Angles(stereoP,stereoN);
     fTanP=TMath::Tan(stereoP);
     fTanN=TMath::Tan(stereoN);
-    Float_t kP = fTanP; // Tangent of 0.0075 mrad
-    Float_t kN = fTanN; // Tangent of 0.0275 mrad
+    Double_t kP = fTanP; // Tangent of 0.0075 mrad
+    Double_t kN = fTanN; // Tangent of 0.0275 mrad
     P *= fPitch;
     N *= fPitch; 
 
@@ -671,13 +722,13 @@ Bool_t AliITSClusterFinderSSD::GetCrossing (Float_t &P, Float_t &N){
     return kTRUE;   
 }
 //______________________________________________________________________
-void AliITSClusterFinderSSD::GetCrossingError(Float_t& dP, Float_t& dN){
+void AliITSClusterFinderSSD::GetCrossingError(Double_t& dP, Double_t& dN){
     // get crossing error
-    Float_t dz, dx;
+    Double_t dz, dx;
 
     dz = TMath::Abs(( dP + dN )*fPitch/(fTanP + fTanN) );
     dx = fPitch*(TMath::Abs(dP*(1 - fTanP/(fTanP + fTanN))) +
-                TMath::Abs(dN *fTanP/(fTanP + fTanN) ));
+                 TMath::Abs(dN *fTanP/(fTanP + fTanN) ));
     dN = dz;
     dP = dx;
 }
index b80bd50..2c0157d 100644 (file)
@@ -3,46 +3,58 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-#include <TMath.h>
+//#include <TMath.h>
 #include "AliITSClusterFinder.h"
-#include "AliITSsegmentationSSD.h"
+//#include "AliITSsegmentationSSD.h"
 
 class TArrayI;
 class AliITSclusterSSD;
 class AliITSpackageSSD;
+class AliITSsegmentation;
+class AliITSsegmentationSSD;
+class AliITSresponse;
+class AliITSresponseSSD;
 
 class AliITSClusterFinderSSD: public AliITSClusterFinder{
- public:
+  public:
     AliITSClusterFinderSSD();
+    AliITSClusterFinderSSD(AliITSsegmentation *seg,AliITSresponse *resp);
     AliITSClusterFinderSSD(AliITSsegmentation *seg, TClonesArray *digits);
     virtual ~AliITSClusterFinderSSD();
-    void FindRawClusters(Int_t module);    
+    void FindRawClusters(Int_t module);
 
- protected:
+  protected:
+    virtual AliITSresponseSSD* GetResp()const{
+        return (AliITSresponseSSD*) GetResponse();}//Return Response
+    //Returns fSegmentation
+    virtual AliITSsegmentationSSD* GetSeg()const{
+        return (AliITSsegmentationSSD*)GetSegmentation();} 
     void      InitReconstruction();
-    Bool_t    CreateNewRecPoint(Float_t P, Float_t dP, Float_t N, Float_t dN,
-                               Float_t Sig,Float_t dSig,
-                               AliITSclusterSSD *clusterP,
-                               AliITSclusterSSD *clusterN,Stat_t prob);
+    Bool_t    CreateNewRecPoint(Double_t P,Double_t dP,Double_t N,Double_t dN,
+                                Double_t Sig,Double_t dSig,
+                                AliITSclusterSSD *clusterP,
+                                AliITSclusterSSD *clusterN,Stat_t prob);
     AliITSclusterSSD* GetPSideCluster(Int_t idx);
     AliITSclusterSSD* GetNSideCluster(Int_t idx);
-    AliITSclusterSSD* GetCluster(Int_t idx, Bool_t side);
-    void      FindNeighbouringDigits();
-    void      SeparateOverlappedClusters();
-    void      SplitCluster(TArrayI *list,Int_t nsplits,Int_t indx,Bool_t side);
-    Int_t     SortDigitsP(Int_t start, Int_t end);
-    Int_t     SortDigitsN(Int_t start, Int_t end);
-    void      FillDigitsIndex();
-    void      SortDigits();
-    void      FillClIndexArrays(Int_t* arrayP, Int_t *arrayN) const;
-    void      SortClusters(Int_t* arrayP, Int_t *arrayN);
-    Int_t     SortClustersP(Int_t start, Int_t end,Int_t *array);
-    Int_t     SortClustersN(Int_t start, Int_t end,Int_t *array);
-    void      ClustersToPackages();
-    Int_t     GetDiff(Float_t */*retx*/, Float_t */*rety*/) const {return 0;}
-    void      CalcStepFactor(Float_t Psteo, Float_t Nsteo );
-    Bool_t GetCrossing(Float_t &x, Float_t &z); //x, y of strips crossing
-    void   GetCrossingError(Float_t& dp, Float_t& dn);//x, y of strips crossing err.
+    AliITSclusterSSD* GetCluster(Int_t idx, Bool_t side){
+    return (side) ? GetPSideCluster(idx) : GetNSideCluster(idx);};
+    void   FindNeighbouringDigits();
+    void   SeparateOverlappedClusters();
+    void   SplitCluster(TArrayI *list,Int_t nsplits,Int_t indx,Bool_t side);
+    Int_t  SortDigitsP(Int_t start, Int_t end);
+    Int_t  SortDigitsN(Int_t start, Int_t end);
+    void   FillDigitsIndex();
+    void   SortDigits();
+    void   FillClIndexArrays(Int_t* arrayP, Int_t *arrayN) const;
+    void   SortClusters(Int_t* arrayP, Int_t *arrayN);
+    Int_t  SortClustersP(Int_t start, Int_t end,Int_t *array);
+    Int_t  SortClustersN(Int_t start, Int_t end,Int_t *array);
+    void   ClustersToPackages();
+    Int_t  GetDiff(Double_t */*retx*/, Double_t */*rety*/) const {return 0;}
+    void   CalcStepFactor(Double_t Psteo, Double_t Nsteo );
+    Bool_t GetCrossing(Double_t &x, Double_t &z); //x, y of strips crossing
+    //x, y of strips crossing err.
+    void   GetCrossingError(Double_t& dp, Double_t& dn);
 
     // Data memebers
     AliITS          *fITS;           //!Pointer to AliITS object
@@ -57,19 +69,19 @@ class AliITSClusterFinderSSD: public AliITSClusterFinder{
     TArrayI         *fDigitsIndexN;  //!Digits on N side
     Int_t            fNDigitsN;      //!Number of Digits on N side
 
-    Float_t          fPitch;         //!Strip pitch
-    Float_t          fTanP;          //!Pside stereo angle tangent
-    Float_t          fTanN;          //!Nside stereo angle tangent
+    Double_t          fPitch;         //!Strip pitch
+    Double_t          fTanP;          //!Pside stereo angle tangent
+    Double_t          fTanN;          //!Nside stereo angle tangent
 
 /*************************************************/
 /**  parameters for reconstruction            ****/
 /**  to be tune when slow simulation raliable ****/
 /*************************************************/
 
-    //Float_t fAlpha1;         //!
-    //Float_t fAlpha2;         //!
-    //Float_t fAlpha3;         //!
-    Float_t fPNsignalRatio;  //!
+    //Double_t fAlpha1;         //!
+    //Double_t fAlpha2;         //!
+    //Double_t fAlpha3;         //!
+    Double_t fPNsignalRatio;  //!
     
     static const Bool_t fgkSIDEP;  //!
     static const Bool_t fgkSIDEN;  //!
@@ -77,7 +89,7 @@ class AliITSClusterFinderSSD: public AliITSClusterFinder{
     Int_t fSFF;              //!forward stepping factor 
     Int_t fSFB;              //!backward stepping factor 
 
-    ClassDef(AliITSClusterFinderSSD, 1) //Class for clustering and reconstruction of space points in SSDs 
+    ClassDef(AliITSClusterFinderSSD,1) //Class for clustering and reconstruction of space points in SSDs 
 
 };
 
index 4f39364..3d80fa8 100644 (file)
 ClassImp(AliITSDetType)         
 
 //______________________________________________________________________
-AliITSDetType::AliITSDetType(){
-    // constructor
-
-    fSegmentation = 0;
-    fResponse     = 0;
-    fSimulation   = 0;
-    fReconst      = 0;
+AliITSDetType::AliITSDetType():
+TObject(),
+fDetType(kND),
+fResponse(0),
+fSegmentation(0),
+fSimulation(0),
+fReconst(0),
+fDigClassName(""),
+fClustClassName(""){
+    // Default constructor.
+    // Inputs:
+    //   none.
+    // Output:
+    //   none.
+    // Return:
+    //   A default constructed AliITSDetType class.
+}
+//______________________________________________________________________
+AliITSDetType::AliITSDetType(AliITSDetector det,AliITSresponse *res,
+                             AliITSsegmentation *seg,AliITSsimulation *sim,
+                             AliITSClusterFinder *cf,
+                             const Char_t *DigClassName,
+                             const Char_t *ClustClassName):
+TObject(),
+fDetType(det),
+fResponse(res),
+fSegmentation(seg),
+fSimulation(sim),
+fReconst(cf),
+fDigClassName(DigClassName),
+fClustClassName(ClustClassName){
+    // Standard constructor
+    // Inputs:
+    //   AliITSDetector       det  Detector type
+    //   AliITSresponse      *res  response class to use
+    //   AliITSsegmentation  *seg  Segmentation class to use
+    //   AliITSsimulation    *sim  Simulation class to use
+    //   AliITSClusterFinder *cf   Cluster Finder/Reconstruction class to use
+    //   const Char_t        DigClassName   Name of the digit class to be used
+    //   const Char_t        ClustClassName Name of the cluster class to be 
+    //                                      used
+    // Output:
+    //   none.
+    // Return:
+    //   A Standard constructed AliITSDetType class.
 }
 //----------------------------------------------------------------------
 AliITSDetType::~AliITSDetType(){
     // destructor
+    // Inputs:
+    //   none.
+    // Output:
+    //   none.
+    // Return:
+    //   none.
 
     if(fSegmentation!=0) delete fSegmentation; fSegmentation = 0;
     if(fResponse!=0)     delete fResponse;     fResponse     = 0;
@@ -49,27 +93,41 @@ AliITSDetType::~AliITSDetType(){
 }
 //______________________________________________________________________
 AliITSDetType::AliITSDetType(const AliITSDetType &source) : TObject(source){
-  //     Copy Constructor 
+    //     Copy Constructor
+    // Inputs:
+    //   const AliITSDetType &source  class to copy from.
+    // Output:
+    //   none.
+    // Return:
+    //   none.
 
-  if(&source == this) return;
-  this->fReconst        = source.fReconst;
-  this->fSimulation     = source.fSimulation;
-  this->fResponse       = source.fResponse;
-  this->fSegmentation   = source.fSegmentation;
-  this->fDigClassName   = source.fDigClassName;
-  this->fClustClassName = source.fClustClassName;
-  return;
+    if(&source == this) return;
+    this->fDetType        = source.fDetType;
+    this->fReconst        = source.fReconst;
+    this->fSimulation     = source.fSimulation;
+    this->fResponse       = source.fResponse;
+    this->fSegmentation   = source.fSegmentation;
+    this->fDigClassName   = source.fDigClassName;
+    this->fClustClassName = source.fClustClassName;
+    return;
 }
 //______________________________________________________________________
 AliITSDetType& AliITSDetType::operator=(const AliITSDetType &source){
-  //    Assignment operator
+    //    Assignment operator
+    // Inputs:
+    //   const AliITSDetType &source  class to copy from.
+    // Output:
+    //   none.
+    // Return:
+    //   a new AliITSDetType class with the same values as in source.
 
-  if(&source == this) return *this;
-  this->fReconst        = source.fReconst;
-  this->fSimulation     = source.fSimulation;
-  this->fResponse       = source.fResponse;
-  this->fSegmentation   = source.fSegmentation;
-  this->fDigClassName   = source.fDigClassName;
-  this->fClustClassName = source.fClustClassName;
-  return *this;  
+    if(&source == this) return *this;
+    this->fDetType        = source.fDetType;
+    this->fReconst        = source.fReconst;
+    this->fSimulation     = source.fSimulation;
+    this->fResponse       = source.fResponse;
+    this->fSegmentation   = source.fSegmentation;
+    this->fDigClassName   = source.fDigClassName;
+    this->fClustClassName = source.fClustClassName;
+    return *this;  
 }
index 2e73c69..30768c7 100644 (file)
@@ -16,6 +16,7 @@
 #include <TString.h>
 #include <TObject.h>
 
+#include "AliITSgeom.h"
 #include "AliITSsegmentation.h"
 #include "AliITSresponse.h"
 
@@ -26,9 +27,17 @@ class AliITSDetType:public TObject{
 
  public:
     AliITSDetType();
+    AliITSDetType(AliITSDetector det,AliITSresponse *res,
+                  AliITSsegmentation *seg,AliITSsimulation *sim,
+                  AliITSClusterFinder *cf,const Char_t *DigClassName,
+                  const Char_t *ClustClassName);
     virtual ~AliITSDetType();
     AliITSDetType(const AliITSDetType &source); // copy constructor
     AliITSDetType& operator=(const AliITSDetType &source); // assign. operator
+    // Return the type of detector these quantities are defined for
+    AliITSDetector GetDetType(){return fDetType;}
+    // Set the type of Detector these quantities are defined for
+    void SetDetType(AliITSDetector det){fDetType = det;}
 
     // Set the defaults
     virtual void   Init() {}
@@ -84,17 +93,17 @@ class AliITSDetType:public TObject{
     TString GetDigitClassName() const { return fDigClassName;}
     // Return the Cluster Class name
     TString GetClusterClassName() const { return fClustClassName;}
-  
+
  protected:
+    AliITSDetector       fDetType;           // Type of detector
     AliITSresponse       *fResponse;         // response
     AliITSsegmentation   *fSegmentation;     // segmentation
     AliITSsimulation     *fSimulation;       // simulation
     AliITSClusterFinder  *fReconst;          // cluster finder
-
     TString              fDigClassName;      // string
     TString              fClustClassName;    // string
 
-    ClassDef(AliITSDetType,1) //Detector simulation/reconstruction class holder
+    ClassDef(AliITSDetType,2) //Detector simulation/reconstruction class holder
 
 };
 
index 4b6fa71..92e5979 100644 (file)
@@ -1,15 +1,17 @@
+#include "AliITS.h"
+#include "AliITSgeom.h"
+#include "AliITSdigit.h"
+#include "AliRun.h"
+#include "AliDetector.h"
 #include "AliITSLoader.h"
 
-
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////
 // Loader for ITS
 // it manages the I/O for:
 // raw clusters, primary vertices
 // V0 and cascade
 // and tracks propagated to the origin
-//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////
 const TString AliITSLoader::fgkDefaultRawClustersContainerName = "TreeC";
 const TString AliITSLoader::fgkDefaultBackTracksContainerName = "TreeB";
 const TString AliITSLoader::fgkDefaultVerticesContainerName = "Vertex";
@@ -18,115 +20,270 @@ const TString AliITSLoader::fgkDefaultCascadeContainerName = "Cascade";
 
 ClassImp(AliITSLoader)
 
-/*****************************************************************************/ 
-
+/**********************************************************************/
   AliITSLoader::AliITSLoader():AliLoader(){
   // Default constructor
+}
+/*********************************************************************/
+AliITSLoader::AliITSLoader(const Char_t *name,const Char_t *topfoldername):
+AliLoader(name,topfoldername){
+  //ctor   
+    AliDataLoader* rawClustersDataLoader = new AliDataLoader(
+        fDetectorName + ".RawCl.root",fgkDefaultRawClustersContainerName,
+        "Raw Clusters");
+    fDataLoaders->Add(rawClustersDataLoader);
+    rawClustersDataLoader->SetEventFolder(fEventFolder);
+    rawClustersDataLoader->SetFolder(GetDetectorDataFolder());
+
+    AliDataLoader* backTracksDataLoader =  new AliDataLoader(
+        fDetectorName + ".BackTracks.root",fgkDefaultBackTracksContainerName,
+        "Back Propagated Tracks");
+    fDataLoaders->Add(backTracksDataLoader);
+    backTracksDataLoader->SetEventFolder(fEventFolder);
+    backTracksDataLoader->SetFolder(GetDetectorDataFolder());
 
+    AliDataLoader* vertexDataLoader = new AliDataLoader(
+        fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,
+        "Primary Vertices","O");
+    fDataLoaders->Add(vertexDataLoader);
+    vertexDataLoader->SetEventFolder(fEventFolder);
+    vertexDataLoader->SetFolder(GetDetectorDataFolder());
+
+    AliDataLoader* v0DataLoader = new AliDataLoader(
+        fDetectorName + ".V0s.root",fgkDefaultV0ContainerName,"V0 Vertices");
+    fDataLoaders->Add(v0DataLoader);
+    v0DataLoader->SetEventFolder(fEventFolder);
+    v0DataLoader->SetFolder(GetDetectorDataFolder());
+
+    AliDataLoader* cascadeDataLoader = new AliDataLoader(
+        fDetectorName + ".Cascades.root",fgkDefaultCascadeContainerName,
+        "Cascades");
+    fDataLoaders->Add(cascadeDataLoader);
+    cascadeDataLoader->SetEventFolder(fEventFolder);
+    cascadeDataLoader->SetFolder(GetDetectorDataFolder());
 }
+/**********************************************************************/
+AliITSLoader::AliITSLoader(const Char_t *name,TFolder *topfolder): 
+AliLoader(name,topfolder) {
+  //ctor  
+    AliDataLoader*  rawClustersDataLoader = new AliDataLoader(
+        fDetectorName + ".RawCl.root",fgkDefaultRawClustersContainerName,
+        "Raw Clusters"); 
+    fDataLoaders->Add(rawClustersDataLoader);
+    rawClustersDataLoader->SetEventFolder(fEventFolder);
+    rawClustersDataLoader->SetFolder(GetDetectorDataFolder());
 
-/*****************************************************************************/ 
-AliITSLoader::AliITSLoader(const Char_t *name,const Char_t *topfoldername): AliLoader(name,topfoldername){
-  //ctor   
-  AliDataLoader* rawClustersDataLoader = new AliDataLoader(fDetectorName + ".RawCl.root",fgkDefaultRawClustersContainerName,"Raw Clusters");
-  fDataLoaders->Add(rawClustersDataLoader);
-  rawClustersDataLoader->SetEventFolder(fEventFolder);
-  rawClustersDataLoader->SetFolder(GetDetectorDataFolder());
-
-  AliDataLoader* backTracksDataLoader = 
-                 new AliDataLoader(fDetectorName + ".BackTracks.root",fgkDefaultBackTracksContainerName,"Back Propagated Tracks");
-  fDataLoaders->Add(backTracksDataLoader);
-  backTracksDataLoader->SetEventFolder(fEventFolder);
-  backTracksDataLoader->SetFolder(GetDetectorDataFolder());
-
-  AliDataLoader* vertexDataLoader = new AliDataLoader(fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,"Primary Vertices","O");
-  fDataLoaders->Add(vertexDataLoader);
-  vertexDataLoader->SetEventFolder(fEventFolder);
-  vertexDataLoader->SetFolder(GetDetectorDataFolder());
-
-  AliDataLoader* v0DataLoader = new AliDataLoader(fDetectorName + ".V0s.root",fgkDefaultV0ContainerName,"V0 Vertices");
-  fDataLoaders->Add(v0DataLoader);
-  v0DataLoader->SetEventFolder(fEventFolder);
-  v0DataLoader->SetFolder(GetDetectorDataFolder());
-   
-  AliDataLoader* cascadeDataLoader = new AliDataLoader(fDetectorName + ".Cascades.root",fgkDefaultCascadeContainerName,"Cascades");
-  fDataLoaders->Add(cascadeDataLoader);
-  cascadeDataLoader->SetEventFolder(fEventFolder);
-  cascadeDataLoader->SetFolder(GetDetectorDataFolder());
-   
+    AliDataLoader*  backTracksDataLoader =  new AliDataLoader(
+        fDetectorName + ".BackTracks.root",fgkDefaultBackTracksContainerName,
+        "Back Propagated Tracks");
+    fDataLoaders->Add(backTracksDataLoader);
+    backTracksDataLoader->SetEventFolder(fEventFolder);
+    backTracksDataLoader->SetFolder(GetDetectorDataFolder());
+
+    AliDataLoader* vertexDataLoader = new AliDataLoader(
+        fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,
+        "Primary Vertices","O");
+    fDataLoaders->Add(vertexDataLoader);
+    vertexDataLoader->SetEventFolder(fEventFolder);
+    vertexDataLoader->SetFolder(GetDetectorDataFolder());
+
+    AliDataLoader* v0DataLoader = new AliDataLoader(
+        fDetectorName + ".V0.root",fgkDefaultV0ContainerName,"V0 Vertices");
+    fDataLoaders->Add(v0DataLoader);
+    v0DataLoader->SetEventFolder(fEventFolder);
+    v0DataLoader->SetFolder(GetDetectorDataFolder());
+
+    AliDataLoader* cascadeDataLoader = new AliDataLoader(
+        fDetectorName + ".Cascade.root",fgkDefaultCascadeContainerName,
+        "Cascades");
+    fDataLoaders->Add(cascadeDataLoader);
+    cascadeDataLoader->SetEventFolder(fEventFolder);
+    cascadeDataLoader->SetFolder(GetDetectorDataFolder());
 }
-/*****************************************************************************/ 
+/**********************************************************************/
+AliITSLoader::~AliITSLoader(){
+    //destructor
+    AliDataLoader* dl = 0;
+    UnloadRawClusters();
+    dl = GetRawClLoader();
+    fDataLoaders->Remove(dl);
 
-AliITSLoader::AliITSLoader(const Char_t *name,TFolder *topfolder): AliLoader(name,topfolder) {
-  //ctor  
-  AliDataLoader*  rawClustersDataLoader = new AliDataLoader(fDetectorName + ".RawCl.root",fgkDefaultRawClustersContainerName,"Raw Clusters"); 
-  fDataLoaders->Add(rawClustersDataLoader);
-  rawClustersDataLoader->SetEventFolder(fEventFolder);
-  rawClustersDataLoader->SetFolder(GetDetectorDataFolder());
-
-  AliDataLoader*  backTracksDataLoader = 
-                  new AliDataLoader(fDetectorName + ".BackTracks.root",fgkDefaultBackTracksContainerName,"Back Propagated Tracks");
-  fDataLoaders->Add(backTracksDataLoader);
-  backTracksDataLoader->SetEventFolder(fEventFolder);
-  backTracksDataLoader->SetFolder(GetDetectorDataFolder());
-
-  AliDataLoader* vertexDataLoader = new AliDataLoader(fDetectorName + ".Vertex.root",fgkDefaultVerticesContainerName,"Primary Vertices","O");
-  fDataLoaders->Add(vertexDataLoader);
-  vertexDataLoader->SetEventFolder(fEventFolder);
-  vertexDataLoader->SetFolder(GetDetectorDataFolder());
-
-  AliDataLoader* v0DataLoader = new AliDataLoader(fDetectorName + ".V0.root",fgkDefaultV0ContainerName,"V0 Vertices");
-  fDataLoaders->Add(v0DataLoader);
-  v0DataLoader->SetEventFolder(fEventFolder);
-  v0DataLoader->SetFolder(GetDetectorDataFolder());
-   
-  AliDataLoader* cascadeDataLoader = new AliDataLoader(fDetectorName + ".Cascade.root",fgkDefaultCascadeContainerName,"Cascades");
-  fDataLoaders->Add(cascadeDataLoader);
-  cascadeDataLoader->SetEventFolder(fEventFolder);
-  cascadeDataLoader->SetFolder(GetDetectorDataFolder());
-   
+    UnloadBackTracks();
+    dl = GetBackTracksDataLoader();
+    fDataLoaders->Remove(dl);
+
+    UnloadVertices();
+    dl = GetVertexDataLoader();
+    fDataLoaders->Remove(dl);
+
+    UnloadV0s();
+    dl = GetV0DataLoader();
+    fDataLoaders->Remove(dl);
+
+    UnloadCascades();
+    dl = GetCascadeDataLoader();
+    fDataLoaders->Remove(dl);
 }
-/*****************************************************************************/ 
-AliITSLoader::~AliITSLoader()
-{
- //destructor
-  AliDataLoader* dl = 0;
-  UnloadRawClusters();
-  dl = GetRawClLoader();
-  fDataLoaders->Remove(dl);
-
-  UnloadBackTracks();
-  dl = GetBackTracksDataLoader();
-  fDataLoaders->Remove(dl);
-
-  UnloadVertices();
-  dl = GetVertexDataLoader();
-  fDataLoaders->Remove(dl);
-
-  UnloadV0s();
-  dl = GetV0DataLoader();
-  fDataLoaders->Remove(dl);
-
-  UnloadCascades();
-  dl = GetCascadeDataLoader();
-  fDataLoaders->Remove(dl);
+//----------------------------------------------------------------------
+AliITS* AliITSLoader::GetITS(){
+    // Returns the pointer to the ITS, kept on the file. A short cut metthod
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Returns:
+    //    Returns a pointer to the ITS, if not found returns 0.
+    AliITS *its;
 
+    if(gAlice){
+        its = dynamic_cast<AliITS*> (gAlice->GetDetector(
+            GetDetectorName().Data()));
+        if(its) return its;
+    } // end if gAlice
+    AliRunLoader *rl=0;
+    rl = GetRunLoader();
+    if(!rl) return 0;
+    AliRun *ar=0;
+    ar = rl->GetAliRun();
+    if(!ar) return 0;
+    its = dynamic_cast<AliITS*> (ar->GetDetector(GetDetectorName().Data()));
+    return its;
 }
+//----------------------------------------------------------------------
+void AliITSLoader::SetupDigits(AliITS *its){
+    // Sets up to store ITS Digits in side AliITS::fDtype TObjArray
+    // Inputs:
+    //    AliITS *its  Pointer to the ITS
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
 
+    its->SetTreeAddressD(TreeD());
+}
+//----------------------------------------------------------------------
+void AliITSLoader::SetupDigits(TObjArray *digPerDet,Int_t n,
+                               const Char_t **digclass){
+    // Sets up digPerDet to store ITS Digits.
+    // Inputs:
+    //    TObjArray *digPerDet   A pointer to a TObject Array size>=3.
+    //    Int_t      n           The size of the TObjArray and digclass array
+    //    Char_t     **digclass  Array of digit class names
+    // Outputs:
+    //    TObjArray *digPerDet   Setup and linked to the tree of digits
+    // Return:
+    //    none.
+    Int_t i,m;
+    TClonesArray *cl = 0;
+    TTree *td = 0;
+    TBranch *br = 0;
+    Char_t branch[13];
+    const Char_t *det[3] = {"SPD","SDD","SSD"};
+
+    if(!digPerDet){
+        Error("SetUpDigits","TObject Array digPerDet does not exist");
+        return;
+    } // end if
+    m = digPerDet->GetSize();
+    if(m<n){
+        Error("SetUpDigits","TObject Array digPerDet=%p must have a size"
+              " at least that of n=%d",digPerDet,n);
+    } // end if
+    if(m<3){
+        Error("SetUpDigits","TObject Array digPerDet=%p must have a size >2",
+              digPerDet);
+        return;
+    } // end if
+    td = TreeD();
+    for(i=0;i<n;i++){
+        if(digPerDet->At(i)==0){ // set up TClones Array
+            digPerDet->AddAt(new TClonesArray(digclass[i],1000),i);
+            if(n==3) sprintf(branch,"ITSDigits%s",det[i]);
+            else     sprintf(branch,"ITSDigits%d",i+1);
+            br = td->GetBranch(branch);
+            br->SetAddress(&((*digPerDet)[i]));
+            continue; // do next one.
+        } // end if
+        cl =  dynamic_cast<TClonesArray*> (digPerDet->At(i));
+        if(!cl && digPerDet->At(i)!=0){  // not a TClonesArray
+            Error("SetUpDigits","TObject Array digPerDet-At(%d)=%p must be "
+                  "zeroed or filled with TClonesArrays",i,digPerDet);
+            return;
+        } // end if
+        if(!(cl->GetClass()->GetBaseClass(AliITSdigit::Class()))){
+            Error("SetUPDigits","TClones array at digPerDet[%d}=%p must be"
+                  "derived from AliITSdigit",i,digPerDet->At(i));
+        } // end if
+        cl->Clear();
+        if(n==3) sprintf(branch,"ITSDigits%s",det[i]);
+        else     sprintf(branch,"ITSDigits%d",i+1);
+        br = td->GetBranch(branch);
+        br->SetAddress(&((*digPerDet)[i]));
+        continue;
+    } // end for i
+}
+//---------------------------------------------------------------------
+AliITSdigit * AliITSLoader::GetDigit(TObjArray *digPerDet,Int_t module,
+                                     Int_t digit){
+    // Gets the digit for for a specific detector type and module.
+    // To be used in conjustion with Setupdigits(AliITS *its).
+    // Inputs:
+    //   TObjArray *digPereDet    Pointer to the Array of digits
+    //   Int_t      module        Module number
+    //   Int_t      digit         Digit number
+    // Outputs:
+    //   none.
+    // Return:
+    //   returns the pointer to the digit. if zero then last digit for that
+    //   module.
+
+    if(digPerDet==0){
+        Error("GetDigit","digPerDet=%p, module=%d, digit=%d",
+              digPerDet,module,digit);
+        return 0;
+    } // end if
+    return 0;
+}
+//---------------------------------------------------------------------
+AliITSdigit * AliITSLoader::GetDigit(AliITS *its,Int_t module,Int_t digit){
+    // Gets the digit for for a specific detector type and module.
+    // To be used in conjustion with Setupdigits(AliITS *its).
+    // Inputs:
+    //   AliITS *its    Pointer to the ITS
+    //   Int_t  module  Module number
+    //   Int_t digit    Digit number
+    // Outputs:
+    //   none.
+    // Return:
+    //   returns the pointer to the digit. if zero then last digit for that
+    //   module.
+    //AliITSDetType *idtype;
+    AliITSgeom *geom = its->GetITSgeom();
+    Int_t idet = geom->GetModuleType(module);
+    TClonesArray *digits;
+    its->ResetDigits();
+    TreeD()->GetEvent(module);
+    digits = its->DigitsAddress(idet);
+    if(digit>-1 && digit<digits->GetEntriesFast()){ // if in range.
+        return (AliITSdigit*) digits->At(digit);
+    } // end if
+    return 0;
+}
+//----------------------------------------------------------------------
 void AliITSLoader::MakeTree(Option_t *opt){
-  // invokes AliLoader::MakeTree + specific ITS tree(s)
-  // Valid options: H,S,D,R,T and C (C=raw clusters)
-  AliLoader::MakeTree(opt);
-  const char *oC = strstr(opt,"C");
-  if (oC) MakeRawClustersContainer();
-
-  const char *oB = strstr(opt,"B");
-  if (oB) MakeBackTracksContainer();
-  
-  const char *oV0 = strstr(opt,"V0");
-  if (oV0) MakeV0Container();
-  
-  const char *oX = strstr(opt,"X");
-  if (oX) MakeCascadeContainer();
-  
+    // invokes AliLoader::MakeTree + specific ITS tree(s)
+    // Valid options: H,S,D,R,T and C (C=raw clusters)
+    AliLoader::MakeTree(opt);
+    const char *oC = strstr(opt,"C");
+    if (oC) MakeRawClustersContainer();
+
+    const char *oB = strstr(opt,"B");
+    if (oB) MakeBackTracksContainer();
+
+    const char *oV0 = strstr(opt,"V0");
+    if (oV0) MakeV0Container();
+
+    const char *oX = strstr(opt,"X");
+    if (oX) MakeCascadeContainer();
 }
index 15a8297..ebba044 100644 (file)
 #include <AliLoader.h>
 #include <AliESDVertex.h>
 
+class AliITS;
+class AliITSdigit;
+class TObjArray;
 
-class AliITSLoader: public AliLoader
- {
-   public:
+class AliITSLoader: public AliLoader{
+  public:
     AliITSLoader();
     AliITSLoader(const Char_t *name,const Char_t *topfoldername);
     AliITSLoader(const Char_t *name,TFolder *topfolder);
-    
+
     virtual ~AliITSLoader();
 
     void           MakeTree(Option_t* opt);
 
+    // General ITS shortcuts
+    virtual AliITS* GetITS(); // Return pointer to the ITS.
+    virtual void    SetupDigits(AliITS *its); // Sets up digit using AliITS
+    virtual void    SetupDigits(TObjArray *digPerDet,Int_t n,
+                                const Char_t **digclass); // Sets up digits
+    // Gets the AliITSdigit for a given module and a specific digit in that
+    // module. Array of digits stored in AliITS (must use 
+    // SetupDigits(AliITS *its)).
+    virtual AliITSdigit* GetDigit(AliITS *its,Int_t module,Int_t digit);
+    // Gets the AliITSdigit for a given module and a specific digit in that
+    // module. Array of digits stored in a user defined TObjArray digPerDet
+    virtual AliITSdigit* GetDigit(TObjArray *digPerDet,Int_t module,Int_t digit);
+
     //Raw Clusters
     AliDataLoader* GetRawClLoader() {return GetDataLoader("Raw Clusters");}
-    virtual void   CleanRawClusters() {GetRawClLoader()->GetBaseLoader(0)->Clean();}
-    Int_t          LoadRawClusters(Option_t* opt=""){return GetRawClLoader()->GetBaseLoader(0)->Load(opt);}
-    void           SetRawClustersFileName(const TString& fname){GetRawClLoader()->SetFileName(fname);}
-    TTree*         TreeC(){ return GetRawClLoader()->Tree();} // returns a pointer to the tree of  RawClusters
-    void           UnloadRawClusters(){GetRawClLoader()->GetBaseLoader(0)->Unload();}
-    virtual Int_t  WriteRawClusters(Option_t* opt=""){return GetRawClLoader()->GetBaseLoader(0)->WriteData(opt);}
+    virtual void   CleanRawClusters() {
+        GetRawClLoader()->GetBaseLoader(0)->Clean();}
+    Int_t          LoadRawClusters(Option_t* opt=""){
+        return GetRawClLoader()->GetBaseLoader(0)->Load(opt);}
+    void           SetRawClustersFileName(const TString& fname){
+        GetRawClLoader()->SetFileName(fname);}
+    // returns a pointer to the tree of  RawClusters
+    TTree*         TreeC(){ return GetRawClLoader()->Tree();} 
+    void           UnloadRawClusters(){
+        GetRawClLoader()->GetBaseLoader(0)->Unload();}
+    virtual Int_t  WriteRawClusters(Option_t* opt=""){
+        return GetRawClLoader()->GetBaseLoader(0)->WriteData(opt);}
 
     //Vertices
-    AliDataLoader* GetVertexDataLoader() {return GetDataLoader("Primary Vertices");}
-    virtual void   CleanVertices() {GetVertexDataLoader()->GetBaseLoader(0)->Clean();}
-    Int_t          LoadVertices(Option_t* opt=""){return GetVertexDataLoader()->GetBaseLoader(0)->Load(opt);}
-    void           SetVerticesFileName(const TString& fname){GetVertexDataLoader()->SetFileName(fname);}
-    void           UnloadVertices(){GetVertexDataLoader()->GetBaseLoader(0)->Unload();}
-    virtual Int_t  WriteVertices(Option_t* opt=""){return GetVertexDataLoader()->GetBaseLoader(0)->WriteData(opt);}
-    virtual Int_t PostVertex(AliESDVertex *ptr){return GetVertexDataLoader()->GetBaseLoader(0)->Post(ptr);}
-    //    virtual void SetVerticesContName(const char *name){GetVertexDataLoader()->GetBaseLoader(0)->SetName(name);}
-    AliESDVertex *GetVertex(){return static_cast <AliESDVertex*>(GetVertexDataLoader()->GetBaseLoader(0)->Get());}
+    AliDataLoader* GetVertexDataLoader() {
+        return GetDataLoader("Primary Vertices");}
+    virtual void   CleanVertices() {
+        GetVertexDataLoader()->GetBaseLoader(0)->Clean();}
+    Int_t          LoadVertices(Option_t* opt=""){
+        return GetVertexDataLoader()->GetBaseLoader(0)->Load(opt);}
+    void           SetVerticesFileName(const TString& fname){
+        GetVertexDataLoader()->SetFileName(fname);}
+    void           UnloadVertices(){
+        GetVertexDataLoader()->GetBaseLoader(0)->Unload();}
+    virtual Int_t  WriteVertices(Option_t* opt=""){
+        return GetVertexDataLoader()->GetBaseLoader(0)->WriteData(opt);}
+    virtual Int_t PostVertex(AliESDVertex *ptr){
+        return GetVertexDataLoader()->GetBaseLoader(0)->Post(ptr);}
+    //    virtual void SetVerticesContName(const char *name){
+    //       GetVertexDataLoader()->GetBaseLoader(0)->SetName(name);}
+    AliESDVertex *GetVertex(){
+        return static_cast <AliESDVertex*>(GetVertexDataLoader()->
+                                           GetBaseLoader(0)->Get());}
 
     //V0s
     AliDataLoader* GetV0DataLoader() {return GetDataLoader("V0 Vertices");}
     virtual void   CleanV0s() {GetV0DataLoader()->GetBaseLoader(0)->Clean();}
-    Int_t          LoadV0s(Option_t* opt=""){return GetV0DataLoader()->GetBaseLoader(0)->Load(opt);}
-    void           SetV0FileName(const TString& fname){GetV0DataLoader()->SetFileName(fname);}
+    Int_t          LoadV0s(Option_t* opt=""){
+        return GetV0DataLoader()->GetBaseLoader(0)->Load(opt);}
+    void           SetV0FileName(const TString& fname){
+        GetV0DataLoader()->SetFileName(fname);}
     void           UnloadV0s(){GetV0DataLoader()->GetBaseLoader(0)->Unload();}
-    virtual Int_t  WriteV0s(Option_t* opt=""){return GetV0DataLoader()->GetBaseLoader(0)->WriteData(opt);}
+    virtual Int_t  WriteV0s(Option_t* opt=""){
+        return GetV0DataLoader()->GetBaseLoader(0)->WriteData(opt);}
     TTree*         TreeV0(){ return GetV0DataLoader()->Tree();}
 
     //Cascades
     AliDataLoader* GetCascadeDataLoader() {return GetDataLoader("Cascades");}
-    virtual void   CleanCascades() {GetCascadeDataLoader()->GetBaseLoader(0)->Clean();}
-    Int_t          LoadCascades(Option_t* opt=""){return GetCascadeDataLoader()->GetBaseLoader(0)->Load(opt);}
-    void           SetCascadeFileName(const TString& fname){GetCascadeDataLoader()->SetFileName(fname);}
-    void           UnloadCascades(){GetCascadeDataLoader()->GetBaseLoader(0)->Unload();}
-    virtual Int_t  WriteCascades(Option_t* opt=""){return GetCascadeDataLoader()->GetBaseLoader(0)->WriteData(opt);}
+    virtual void   CleanCascades() {
+        GetCascadeDataLoader()->GetBaseLoader(0)->Clean();}
+    Int_t          LoadCascades(Option_t* opt=""){
+        return GetCascadeDataLoader()->GetBaseLoader(0)->Load(opt);}
+    void           SetCascadeFileName(const TString& fname){
+        GetCascadeDataLoader()->SetFileName(fname);}
+    void           UnloadCascades(){
+        GetCascadeDataLoader()->GetBaseLoader(0)->Unload();}
+    virtual Int_t  WriteCascades(Option_t* opt=""){
+        return GetCascadeDataLoader()->GetBaseLoader(0)->WriteData(opt);}
     TTree*         TreeX(){ return GetCascadeDataLoader()->Tree();}
 
     //Back Propagated Tracks
-    AliDataLoader* GetBackTracksDataLoader() {return GetDataLoader("Back Propagated Tracks");}
-    virtual void   CleanBackTracks() {GetBackTracksDataLoader()->GetBaseLoader(0)->Clean();}
-    Int_t          LoadBackTracks(Option_t* opt=""){return GetBackTracksDataLoader()->GetBaseLoader(0)->Load(opt);}
-    void           SetBackTracksFileName(const TString& fname){GetBackTracksDataLoader()->SetFileName(fname);}
-    TTree*         TreeB(){ return GetBackTracksDataLoader()->Tree();} // returns a pointer to the tree of  BackTracks
-    void           UnloadBackTracks(){GetBackTracksDataLoader()->GetBaseLoader(0)->Unload();}
-    virtual Int_t  WriteBackTracks(Option_t* opt=""){return GetBackTracksDataLoader()->GetBaseLoader(0)->WriteData(opt);}
-    
-
-   protected:
+    AliDataLoader* GetBackTracksDataLoader() {
+        return GetDataLoader("Back Propagated Tracks");}
+    virtual void   CleanBackTracks() {
+        GetBackTracksDataLoader()->GetBaseLoader(0)->Clean();}
+    Int_t          LoadBackTracks(Option_t* opt=""){
+        return GetBackTracksDataLoader()->GetBaseLoader(0)->Load(opt);}
+    void           SetBackTracksFileName(const TString& fname){
+        GetBackTracksDataLoader()->SetFileName(fname);}
+     // returns a pointer to the tree of  BackTracks
+    TTree*         TreeB(){ return GetBackTracksDataLoader()->Tree();}
+    void           UnloadBackTracks(){
+        GetBackTracksDataLoader()->GetBaseLoader(0)->Unload();}
+    virtual Int_t  WriteBackTracks(Option_t* opt=""){
+        return GetBackTracksDataLoader()->GetBaseLoader(0)->WriteData(opt);}
+
+  protected:
 
     // METHODS
     virtual void   MakeRawClustersContainer() {GetRawClLoader()->MakeTree();}
-    Int_t          PostRawClusters(){return GetRawClLoader()->GetBaseLoader(0)->Post();}
+    Int_t          PostRawClusters(){
+        return GetRawClLoader()->GetBaseLoader(0)->Post();}
 
-    virtual void   MakeBackTracksContainer() {GetBackTracksDataLoader()->MakeTree();}
-    Int_t          PostBackTracks(){return GetBackTracksDataLoader()->GetBaseLoader(0)->Post();}
+    virtual void   MakeBackTracksContainer() {
+        GetBackTracksDataLoader()->MakeTree();}
+    Int_t          PostBackTracks(){
+        return GetBackTracksDataLoader()->GetBaseLoader(0)->Post();}
     virtual void   MakeV0Container() {GetV0DataLoader()->MakeTree();}
-    Int_t          PostV0s(){return GetV0DataLoader()->GetBaseLoader(0)->Post();}
+    Int_t          PostV0s(){
+        return GetV0DataLoader()->GetBaseLoader(0)->Post();}
 
     virtual void   MakeCascadeContainer() {GetCascadeDataLoader()->MakeTree();}
-    Int_t          PostCascades(){return GetCascadeDataLoader()->GetBaseLoader(0)->Post();}
+    Int_t          PostCascades(){
+        return GetCascadeDataLoader()->GetBaseLoader(0)->Post();}
 
     // DATA
     static const TString fgkDefaultRawClustersContainerName;  //default for Raw Clusters container name
@@ -85,9 +135,7 @@ class AliITSLoader: public AliLoader
     static const TString fgkDefaultV0ContainerName;           //default for V0 container name
     static const TString fgkDefaultCascadeContainerName;      //default fo cascade container name
 
-     ClassDef(AliITSLoader,3)
- };
+    ClassDef(AliITSLoader,3) // Loader for additional ITS specific trees.
+};
  
 #endif
-
-
index 3ec6e48..eca282a 100644 (file)
@@ -19,19 +19,19 @@ AliITSdcsSSD::AliITSdcsSSD(){
 AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp){
     // Standard constructor
 
-    fNstrips = seg->Npx();
+    fNstrips =(Float_t) (((AliITSsegmentationSSD*)seg)->Npx());
     
     fInvalidP = new TArrayS();
     fInvalidN = new TArrayS();
 
-    Int_t npar=resp->NDetParam();
+    Int_t npar=((AliITSresponseSSD*)resp)->NDetParam();
     if (npar < 6) {
        Warning("AliITSdcsSSD","I need 6 parameters ");
        npar=6;
     } // end if
 
-    Float_t *detpar= new Float_t[npar];
-    resp->GetDetParam(detpar);
+    Double_t *detpar= new Double_t[npar];
+    ((AliITSresponseSSD*)resp)->GetDetParam(detpar);
 
     fNInvalid = detpar[0];
     fISigma   = detpar[1];
@@ -42,7 +42,7 @@ AliITSdcsSSD::AliITSdcsSSD(AliITSsegmentation *seg, AliITSresponse *resp){
     fCouplingNL = detpar[5];
 
     char opt[30],dummy[20];
-    resp->ParamOptions(opt,dummy);
+    ((AliITSresponseSSD*)resp)->ParamOptions(opt,dummy);
     if (strstr(opt,"SetInvalid")) SetInvalidMC(fNInvalid,fISigma);
 
     delete [] detpar;
index da35309..cadb61d 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "AliITSgeomMatrix.h"
 
-typedef enum {kSPD=0, kSDD=1, kSSD=2, kSSDp=3,kSDDp=4} AliITSDetector;
+typedef enum {kND=-1,kSPD=0, kSDD=1, kSSD=2, kSSDp=3,kSDDp=4} AliITSDetector;
 
 //_______________________________________________________________________
 
index ca61ec9..7f2f8d0 100644 (file)
@@ -28,44 +28,22 @@ class AliITSresponse : public TObject {
     // Configuration methods
     //
 
-    // Set Electronics
-    virtual void    SetElectronics(Int_t) = 0;
-    // Get Electronics
-    virtual Int_t Electronics() const = 0;
-
-    // Set maximum Adc-count value
-    virtual void    SetMaxAdc(Float_t) = 0;
-    // Get maximum Adc-count value
-    virtual Float_t MaxAdc() const = 0;
-
-    // Set maximum Adc-top value
-    virtual void    SetDynamicRange(Float_t) = 0;
-    // Get maximum Adc-top value
-    virtual Float_t DynamicRange() const = 0;
-
-    // Set Charge Loss Linear Coefficient
-    virtual void    SetChargeLoss(Float_t) = 0;
-    // Get Charge Loss Linear Coefficient
-    virtual Float_t ChargeLoss() const = 0;
-
     // Set GeVcharge value
-    virtual void SetGeVToCharge(Float_t gc=2.778E+8){fGeVcharge = gc;}
+    virtual void SetGeVToCharge(Double_t gc=2.778E+8){fGeVcharge = gc;}
     // Returns the value fGeVcharge
-    virtual Float_t GetGeVToCharge() const {return fGeVcharge;}
+    virtual Double_t GetGeVToCharge() const {return fGeVcharge;}
     // Converts deposited energy to number of electrons liberated
-    virtual Float_t GeVToCharge(Float_t gev) const {return gev*fGeVcharge;}
+    virtual Double_t GeVToCharge(Double_t gev) const {return gev*fGeVcharge;}
 
     // Diffusion coefficient
-    virtual void    SetDiffCoeff(Float_t, Float_t) = 0;
+    virtual void    SetDiffCoeff(Double_t, Double_t) = 0;
     // Get diffusion coefficients
-    virtual void    DiffCoeff(Float_t &,Float_t &) const = 0;
+    virtual void    DiffCoeff(Double_t &,Double_t &) const = 0;
 
     // Temperature in [degree K]
-    virtual void    SetTemperature(Float_t t=300.0) {fT = t;}
+    virtual void    SetTemperature(Double_t t=300.0) {fT = t;}
     // Get temperature [degree K]
-    virtual Float_t Temperature() const {return fT;}
-    // Type of data - real or simulated
-    virtual void    SetDataType(const char *data="simulated") {fDataType=data;}
+    virtual Double_t Temperature() const {return fT;}
     // Set the impurity concentrations in [#/cm^3]
     virtual void SetImpurity(Double_t n=0.0){fN = n;}
     // Returns the impurity consentration in [#/cm^3]
@@ -77,68 +55,71 @@ class AliITSresponse : public TObject {
     virtual void SetDistanceOverVoltage(Double_t dv=0.000375){fdv = dv;}
     // Returns the ration distance/voltage
     virtual Double_t DistanceOverVoltage() const {return fdv;}
     // Get data type
     virtual const char  *DataType() const {return fDataType.Data();}
+    // Type of data - real or simulated
+    virtual void    SetDataType(const char *data="simulated") {fDataType=data;}
     // Set parameters options: "same" or read from "file" or "SetInvalid" or...
     virtual void   SetParamOptions(const char*,const char*) = 0;
     // Set noise parameters 
-    virtual void   SetNoiseParam(Float_t, Float_t) = 0;
+    virtual void   SetNoiseParam(Double_t, Double_t) = 0;
     // Number of parameters to be set
     virtual  void   SetNDetParam(Int_t) = 0;
     // Set detector parameters: gain, coupling ...
-    virtual  void   SetDetParam(Float_t *) = 0;
+    virtual  void   SetDetParam(Double_t *) = 0;
 
     // Parameters options
     virtual void   ParamOptions(char *,char*) const = 0;
     virtual Int_t  NDetParam() const = 0;
-    virtual void   GetDetParam(Float_t *) const = 0;
-    virtual void   GetNoiseParam(Float_t&, Float_t&) const = 0;
+    virtual void   GetDetParam(Double_t *) const = 0;
+    virtual void   GetNoiseParam(Double_t&, Double_t&) const = 0;
 
     // Zero-suppression option - could be 1D, 2D or non-ZeroSuppressed
     virtual void   SetZeroSupp(const char*) = 0;
     // Get zero-suppression option
     virtual const char *ZeroSuppOption() const = 0;
      // Set thresholds
-    virtual void   SetThresholds(Float_t, Float_t) = 0;
-    virtual void   Thresholds(Float_t &, Float_t &) const = 0;
+    virtual void   SetThresholds(Double_t, Double_t) = 0;
+    virtual void   Thresholds(Double_t &, Double_t &) const = 0;
 
     // Set filenames
-    virtual void SetFilenames(const char *f1="",const char *f2="",const char *f3=""){
+    virtual void SetFilenames(const char *f1="",const char *f2="",
+                              const char *f3=""){
        // Set filenames - input, output, parameters ....
        fFileName1=f1; fFileName2=f2; fFileName3=f3;}
     // Filenames
     virtual void   Filenames(char* input,char* baseline,char* param) {
-       strcpy(input,fFileName1.Data());  strcpy(baseline,fFileName2.Data());  
-       strcpy(param,fFileName3.Data());}
+        strcpy(input,fFileName1.Data());  strcpy(baseline,fFileName2.Data());  
+        strcpy(param,fFileName3.Data());}
 
-    virtual void    SetDriftSpeed(Float_t p1) = 0;
-    virtual Float_t DriftSpeed() const = 0;
-    virtual void    SetOutputOption(Bool_t write=kFALSE) {// set output option
-       fWrite = write;}
+    virtual Double_t DriftSpeed() const {return SpeedElectron();};
+    // set output option
+    virtual void    SetOutputOption(Bool_t write=kFALSE) {fWrite = write;}
+       
     virtual Bool_t  OutputOption() const {return fWrite;}
     virtual Bool_t  Do10to8() const {return kTRUE;}
     virtual void    GiveCompressParam(Int_t *) const =0;
     //
     // Detector type response methods
     // Set number of sigmas over which cluster disintegration is performed
-    virtual void    SetNSigmaIntegration(Float_t) = 0;
+    virtual void    SetNSigmaIntegration(Double_t) = 0;
     // Get number of sigmas over which cluster disintegration is performed
-    virtual Float_t NSigmaIntegration() const = 0;
+    virtual Double_t NSigmaIntegration() const = 0;
     // Set number of bins for the gaussian lookup table
     virtual void    SetNLookUp(Int_t) = 0;
     // Get number of bins for the gaussian lookup table
     virtual Int_t GausNLookUp() const {return 0;}
     // Get scaling factor for bin i-th from the gaussian lookup table
-    virtual Float_t GausLookUp(Int_t) const {return 0.;}
+    virtual Double_t GausLookUp(Int_t) const {return 0.;}
     // Set sigmas of the charge spread function
-    virtual void    SetSigmaSpread(Float_t, Float_t) = 0;
+    virtual void    SetSigmaSpread(Double_t, Double_t) = 0;
     // Get sigmas for the charge spread
-    virtual void    SigmaSpread(Float_t &,Float_t &) const = 0;
+    virtual void    SigmaSpread(Double_t &,Double_t &) const = 0;
     // Pulse height from scored quantity (eloss)
-    virtual Float_t IntPH(Float_t) const {return 0.;}
+    virtual Double_t IntPH(Double_t) const {return 0.;}
     // Charge disintegration
-    virtual Float_t IntXZ(AliITSsegmentation *) const {return 0.;}
+    virtual Double_t IntXZ(AliITSsegmentation *) const {return 0.;}
     // Electron mobility in Si. [cm^2/(Volt Sec)]. T in degree K, N in #/cm^3
     virtual Double_t MobilityElectronSiEmp() const ;
     // Hole mobility in Si. [cm^2/(Volt Sec)]  T in degree K, N in #/cm^3
index 6f3dc7b..3dffc37 100644 (file)
@@ -32,19 +32,19 @@ const Int_t AliITSresponseSDD::fgkModules;
 const Int_t AliITSresponseSDD::fgkChips;  
 const Int_t AliITSresponseSDD::fgkChannels; 
 const Int_t AliITSresponseSDD::fgkMaxAdcDefault = 1024;
-const Float_t AliITSresponseSDD::fgkDynamicRangeDefault = 132.;
-const Float_t AliITSresponseSDD::fgkfChargeLossDefault = 0;
-const Float_t AliITSresponseSDD::fgkDiffCoeffDefault = 3.23;
-const Float_t AliITSresponseSDD::fgkDiffCoeff1Default = 30.;
-const Float_t AliITSresponseSDD::fgkTemperatureDefault = 296.;
+const Double_t AliITSresponseSDD::fgkDynamicRangeDefault = 132.;
+const Double_t AliITSresponseSDD::fgkfChargeLossDefault = 0;
+const Double_t AliITSresponseSDD::fgkDiffCoeffDefault = 3.23;
+const Double_t AliITSresponseSDD::fgkDiffCoeff1Default = 30.;
+const Double_t AliITSresponseSDD::fgkTemperatureDefault = 296.;
 const TString AliITSresponseSDD::fgkParam1Default = "same";
 const TString AliITSresponseSDD::fgkParam2Default = "same";
-const Float_t AliITSresponseSDD::fgkNoiseDefault = 10.;
-const Float_t AliITSresponseSDD::fgkBaselineDefault = 20.;
+const Double_t AliITSresponseSDD::fgkNoiseDefault = 10.;
+const Double_t AliITSresponseSDD::fgkBaselineDefault = 20.;
 const TString AliITSresponseSDD::fgkOptionDefault = "1D";
-const Float_t AliITSresponseSDD::fgkMinValDefault  = 4;
-const Float_t AliITSresponseSDD::fgkDriftSpeedDefault = 7.3;
-const Float_t AliITSresponseSDD::fgkNsigmasDefault = 3.;
+const Double_t AliITSresponseSDD::fgkMinValDefault  = 4;
+const Double_t AliITSresponseSDD::fgkDriftSpeedDefault = 7.3;
+const Double_t AliITSresponseSDD::fgkNsigmasDefault = 3.;
 const Int_t AliITSresponseSDD::fgkNcompsDefault = 121;
 //______________________________________________________________________
 ClassImp(AliITSresponseSDD)
@@ -191,7 +191,7 @@ void AliITSresponseSDD::SetNLookUp(Int_t p1){
   fNcomps=p1;
   fGaus = new TArrayF(fNcomps+1);
   for(Int_t i=0; i<=fNcomps; i++) {
-    Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
+    Double_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
     (*fGaus)[i] = exp(-((x*x)/2));
     //     cout << "fGaus[" << i << "]: " << fGaus->At(i) << endl;
   }
index c4734cc..dbc191c 100644 (file)
 // response for SDD
 
 class AliITSresponseSDD : public AliITSresponse {
- public:
-  //
-  // Configuration methods
-  //
-  
+  public:
+    //
+    // Configuration methods
+    //
     AliITSresponseSDD();
     AliITSresponseSDD(const char *dataType);
     virtual ~AliITSresponseSDD();
 
-// Implementation of virtual member functions declared in AliITSresponse 
+    // Implementation of virtual member functions declared in AliITSresponse 
     virtual void SetElectronics(Int_t p1=1) 
       {fElectronics=p1;  /* Electronics: Pascal (1) or OLA (2) */ }
     virtual Int_t Electronics() const {// Electronics: 1 = Pascal; 2 = OLA
        return fElectronics;}
-    virtual void    SetMaxAdc(Float_t p1) {// Adc-count saturation value
+    virtual void    SetMaxAdc(Double_t p1) {// Adc-count saturation value
        fMaxAdc=p1;}
-    virtual Float_t MaxAdc() const {// Get maximum Adc-count value
+    virtual Double_t MaxAdc() const {// Get maximum Adc-count value
        return fMaxAdc;}
-    virtual void    SetChargeLoss(Float_t p1) {
+    virtual void    SetChargeLoss(Double_t p1) {
        // Set Linear Charge Loss Steepness  // 0.01 for 20%
        fChargeLoss=p1;}
-    Float_t ChargeLoss() const {// Get Charge Loss Coefficient
+    Double_t ChargeLoss() const {// Get Charge Loss Coefficient
        return fChargeLoss;}
-    virtual void    SetDynamicRange(Float_t p1) {// Set Dynamic Range
+    virtual void    SetDynamicRange(Double_t p1) {// Set Dynamic Range
        fDynamicRange = p1;}
-    virtual Float_t DynamicRange() const {// Get Dynamic Range
+    virtual Double_t DynamicRange() const {// Get Dynamic Range
        return fDynamicRange;}
     // Diffusion coefficients
-    virtual void    SetDiffCoeff(Float_t p1, Float_t p2) 
+    virtual void    SetDiffCoeff(Double_t p1, Double_t p2) 
        {fDiffCoeff=p1;fDiffCoeff1=p2;}
     // Get diffusion coefficients
-    virtual void DiffCoeff(Float_t&diff,Float_t&diff1) const 
+    virtual void DiffCoeff(Double_t&diff,Double_t&diff1) const 
        {diff = fDiffCoeff;diff1 = fDiffCoeff1;}
-    virtual void    SetDriftSpeed(Float_t p1) {// Drift velocity
+    virtual void    SetDriftSpeed(Double_t p1) {// Drift velocity
        fDriftSpeed=p1;}
-    virtual Float_t DriftSpeed() const {// drift speed
+    virtual Double_t DriftSpeed() const {// drift speed
        return fDriftSpeed;}
     virtual void SetParamOptions(const char *opt1,const char *opt2){
        // Parameters: "same" or read from "file" 
        fParam1=opt1; fParam2=opt2;}
     virtual void   ParamOptions(char *opt1,char *opt2) const {// options
        strcpy(opt1,fParam1.Data()); strcpy(opt2,fParam2.Data());}
-    virtual void  SetNoiseParam(Float_t n, Float_t b){
+    virtual void  SetNoiseParam(Double_t n, Double_t b){
        // Noise and baseline  // 10 for ALICE with beam test measurements 2001
        fNoise=n; fBaseline=b;}
-    virtual void  GetNoiseParam(Float_t &n, Float_t &b) const {// get noise param
-       n=fNoise; b=fBaseline;}
+        // get noise param
+    virtual void  GetNoiseParam(Double_t &n, Double_t &b) const
+        {n=fNoise; b=fBaseline;}
     virtual Bool_t Do10to8() const {// get 10 to 8 compression option
        return fBitComp;}
     void    SetZeroSupp (const char *opt) {
@@ -68,38 +68,38 @@ class AliITSresponseSDD : public AliITSresponse {
        fOption=opt;}
     const char *ZeroSuppOption() const {// Get zero-suppression option
        return fOption.Data();}
-    virtual void   SetThresholds(Float_t  mv, Float_t /* b */){
+    virtual void   SetThresholds(Double_t  mv, Double_t /* b */){
        // Min value used in 2D - could be used as a threshold setting
        fMinVal = mv;}
-    virtual void   Thresholds(Float_t &  mv, Float_t & /* b */) const 
+    virtual void   Thresholds(Double_t &  mv, Double_t & /* b */) const 
       {mv = fMinVal;}
     virtual void  GiveCompressParam(Int_t *x) const;
     // Detector type response methods
-    virtual void    SetNSigmaIntegration(Float_t p1) {
+    virtual void    SetNSigmaIntegration(Double_t p1) {
        // Set number of sigmas over which cluster disintegration is performed
        fNsigmas=p1;}
-    virtual Float_t NSigmaIntegration() const {
+    virtual Double_t NSigmaIntegration() const {
        // Get number of sigmas over which cluster disintegration is performed
        return fNsigmas;}
     virtual void SetNLookUp(Int_t p1);
     // Get number of intervals in which the gaussian lookup table is divided
     virtual Int_t GausNLookUp() const {return fNcomps;}
-    virtual Float_t GausLookUp(Int_t i) const  {
+    virtual Double_t GausLookUp(Int_t i) const  {
        if(i<0 || i>=fNcomps) return 0.;return fGaus->At(i);}
    
 //Declaration of member functions peculiar to this class
     Int_t Convert8to10(Int_t signal) const; //undo 10 to 8 bit SDD compresion
-    void  SetNoiseAfterElectronics(Float_t n=2.38){
+    void  SetNoiseAfterElectronics(Double_t n=2.38){
        // Noise after electronics (ADC units)
        // 2.36 for ALICE from beam test measurements 2001
        fNoiseAfterEl=n;}
-    Float_t  GetNoiseAfterElectronics() const {
+    Double_t  GetNoiseAfterElectronics() const {
        // Noise after electronics (ADC units)
        return fNoiseAfterEl;}
-    void  SetJitterError(Float_t jitter=20) {
+    void  SetJitterError(Double_t jitter=20) {
        // set Jitter error (20 um for ALICE from beam test measurements 2001)
        fJitterError=jitter;}
-    Float_t  JitterError() const {// set Jitter error
+    Double_t  JitterError() const {// set Jitter error
        return fJitterError;}
     void  SetDo10to8(Bool_t bitcomp=kTRUE) {
        // set the option for 10 to 8 bit compression
@@ -110,27 +110,28 @@ class AliITSresponseSDD : public AliITSresponse {
     Int_t GetDeadModules() const { return fDeadModules; }
     Int_t GetDeadChips() const { return fDeadChips; }
     Int_t GetDeadChannels() const { return fDeadChannels; }
-    Float_t Gain(Int_t mod,Int_t chip,Int_t ch)const {return fGain[mod][chip][ch]; }
+    Double_t Gain(Int_t mod,Int_t chip,Int_t ch)const 
+        {return fGain[mod][chip][ch]; }
     // these functions should be move to AliITSsegmentationSDD
-    const Int_t Modules() const{return fgkModules;}// Total number of SDD modules
+    const Int_t Modules()const{return fgkModules;}//Total number of SDD modules
     const Int_t Chips() const{return fgkChips;} // Number of chips/module
-    const Int_t Channels() const { return fgkChannels;}// Number of channels/chip
+    const Int_t Channels() const{ return fgkChannels;}//Number of channels/chip
     //********
     void    PrintGains();
     void    Print();
 
     // not implemented virtual methods (devlared in the mother class
-    virtual  void   SetDetParam(Float_t *)
+    virtual  void   SetDetParam(Double_t *)
       {NotImplemented("SetDetParam");}
-    virtual void   GetDetParam(Float_t *) const 
+    virtual void   GetDetParam(Double_t *) const 
       {NotImplemented("GetDetParam");}
     virtual  void   SetNDetParam(Int_t /* n */)
       {NotImplemented("SetNDetParam");}
     virtual Int_t  NDetParam() const
       {NotImplemented("NDetParam"); return 0;}
-    virtual void    SetSigmaSpread(Float_t, Float_t) 
+    virtual void    SetSigmaSpread(Double_t, Double_t) 
       {NotImplemented("SetSigmaSpread");}
-    virtual void    SigmaSpread(Float_t & /* p1 */,Float_t & /* p2 */) const 
+    virtual void    SigmaSpread(Double_t & /* p1 */,Double_t & /* p2 */) const 
       {NotImplemented("SigmaSpread");}
 
  protected:
@@ -140,43 +141,43 @@ class AliITSresponseSDD : public AliITSresponse {
     static const Int_t fgkChannels = 64;    // Number of channels/chip
     //*******
     static const Int_t fgkMaxAdcDefault; // default for fMaxAdc
-    static const Float_t fgkDynamicRangeDefault; // default for fDynamicRange
-    static const Float_t fgkfChargeLossDefault; // default for fChargeLoss
-    static const Float_t fgkDiffCoeffDefault; // default for fDiffCoeff
-    static const Float_t fgkDiffCoeff1Default; // default for fDiffCoeff1 
-    static const Float_t fgkTemperatureDefault; // default for fT (Kelvin)
+    static const Double_t fgkDynamicRangeDefault; // default for fDynamicRange
+    static const Double_t fgkfChargeLossDefault; // default for fChargeLoss
+    static const Double_t fgkDiffCoeffDefault; // default for fDiffCoeff
+    static const Double_t fgkDiffCoeff1Default; // default for fDiffCoeff1 
+    static const Double_t fgkTemperatureDefault; // default for fT (Kelvin)
     static const TString fgkParam1Default; // default for fParam1
     static const TString fgkParam2Default; // default for fParam2
-    static const Float_t fgkNoiseDefault; // default for fNoise
-    static const Float_t fgkBaselineDefault; // default for fBaseline
+    static const Double_t fgkNoiseDefault; // default for fNoise
+    static const Double_t fgkBaselineDefault; // default for fBaseline
     static const TString fgkOptionDefault; // default for fOption
-    static const Float_t fgkMinValDefault; // default for fMinVal
-    static const Float_t fgkDriftSpeedDefault; // default for fDriftSpeed
-    static const Float_t fgkNsigmasDefault; //default for fNsigmas
+    static const Double_t fgkMinValDefault; // default for fMinVal
+    static const Double_t fgkDriftSpeedDefault; // default for fDriftSpeed
+    static const Double_t fgkNsigmasDefault; //default for fNsigmas
     static const Int_t fgkNcompsDefault; //default for fNcomps
     //
 
     Int_t fDeadModules;                   // Total number of dead SDD modules
     Int_t fDeadChips;                     // Number of dead chips
     Int_t fDeadChannels;                  // Number of dead channels
-    Float_t   fGain[fgkModules][fgkChips][fgkChannels];   // Array for channel gains
+    Double_t fGain[fgkModules][fgkChips][fgkChannels];//Array for channel gains
     Int_t     fCPar[8];        // Hardware compression parameters
-    Float_t   fNoise;          // Noise
-    Float_t   fBaseline;       // Baseline
-    Float_t   fNoiseAfterEl;   // Noise after electronics
-    Float_t   fJitterError;    // jitter error
-    Float_t   fDynamicRange;   // Set Dynamic Range 
-    Float_t   fChargeLoss;     // Set Linear Coefficient for Charge Loss 
-    Float_t   fDriftSpeed;     // Drift velocity
+    Double_t   fNoise;          // Noise
+    Double_t   fBaseline;       // Baseline
+    Double_t   fNoiseAfterEl;   // Noise after electronics
+    Double_t   fJitterError;    // jitter error
+    Double_t   fDynamicRange;   // Set Dynamic Range 
+    Double_t   fChargeLoss;     // Set Linear Coefficient for Charge Loss 
+    Double_t   fDriftSpeed;     // Drift velocity
     Int_t     fElectronics;    // Electronics
-    Float_t   fMaxAdc;         // Adc saturation value
-    Float_t   fDiffCoeff;      // Diffusion Coefficient (scaling the time)
-    Float_t   fDiffCoeff1;     // Diffusion Coefficient (constant term)
-    Float_t   fNsigmas;    // Number of sigmas over which charge disintegration
+    Double_t   fMaxAdc;         // Adc saturation value
+    Double_t   fDiffCoeff;      // Diffusion Coefficient (scaling the time)
+    Double_t   fDiffCoeff1;     // Diffusion Coefficient (constant term)
+    Double_t   fNsigmas;   // Number of sigmas over which charge disintegration
                                // is performed
     TArrayF   *fGaus;          // Gaussian lookup table for signal generation
     Int_t      fNcomps;        // Number of samplings along the gaussian
-    Float_t      fMinVal;        // Min value used in 2D zero-suppression algo
+    Double_t      fMinVal;        // Min value used in 2D zero-suppression algo
     Bool_t     fBitComp;       // 10 to 8 bit compression option
     TString    fOption;        // Zero-suppresion option (1D, 2D or none)
     TString    fParam1;        // Read baselines from file option
index 3ef7697..0c88001 100644 (file)
 
 #include "AliITSresponseSPD.h"
 
-const Float_t AliITSresponseSPD::fgkDiffCoeffDefault = 0.;
-const Float_t AliITSresponseSPD::fgkThreshDefault = 2000.;
-const Float_t AliITSresponseSPD::fgkSigmaDefault = 280.;
+const Double_t AliITSresponseSPD::fgkDiffCoeffDefault = 0.;
+const Double_t AliITSresponseSPD::fgkThreshDefault = 2000.;
+const Double_t AliITSresponseSPD::fgkSigmaDefault = 280.;
 
 ClassImp(AliITSresponseSPD)    
 //______________________________________________________________________
-AliITSresponseSPD::AliITSresponseSPD(){
+AliITSresponseSPD::AliITSresponseSPD():
+AliITSresponse(),
+fBaseline(0.0),
+fNoise(0.0),
+fThresh(fgkThreshDefault),
+fSigma(fgkSigmaDefault),
+fCouplCol(0.0),
+fCouplRow(0.0),
+fDeadPixels(0.01){
   // constructor
 
    SetThresholds(fgkThreshDefault,fgkSigmaDefault);
-   SetDiffCoeff(fgkDiffCoeffDefault,0.);
+   //SetDiffCoeff(fgkDiffCoeffDefault,0.);
    SetNoiseParam(0.,0.);
-   SetDataType();
+   SetDataType("simulated");
    SetFractionDead();
 }
+//_________________________________________________________________________
+Bool_t AliITSresponseSPD::IsPixelDead(Int_t mod,Int_t ix,Int_t iz) const {
+  // Returns kTRUE if pixel is dead
+  // Inputs:
+  //    Int_t mod      module number
+  //    Int_t ix       x pixel number
+  //    Int_t iz       z pixel number
+  // Outputs:
+  //    none.
+  // Return:
+  //    kFALSE if pixel is alive, or kTRUE if pixel is dead.
+  Bool_t  dead = kFALSE;
+  Int_t   seed;
+  static TRandom ran; // don't use gRandom. This must not be a true randome
+  // sequence. These sequence must be random one and then fully repetable.
 
+  seed = mod*256*256+iz*256+ix;
+  ran.SetSeed(seed);
+  if(ran.Rndm(0)<fDeadPixels) dead = kTRUE;
+  return dead;
+}
index 971ed87..7a69c5a 100644 (file)
@@ -6,9 +6,8 @@
 /*
 $Id$
 */
-
+#include "TRandom.h"
 #include "AliITSresponse.h"
-
 //----------------------------------------------
 //
 // ITS response class for SPD
@@ -18,54 +17,53 @@ class AliITSresponseSPD :  public AliITSresponse {
     AliITSresponseSPD(); // default constructor
     virtual ~AliITSresponseSPD() {} // destructror
 
-    // Implementation of virtual member functions declared in AliITSresponse 
-    // sets the diffusion coeffecient.
-    virtual  void   SetDiffCoeff(Float_t p1, Float_t /*dummy */) {fDiffCoeff=p1;}
-    // returns the diffusion coeffeciant
-    virtual  void   DiffCoeff(Float_t &p1, Float_t & /*p2 */) const 
-                             {p1 = fDiffCoeff;}
     // Set Threshold and noise + threshold fluctuations parameter values
-    virtual  void   SetThresholds(Float_t thresh, Float_t sigma)
+    virtual  void   SetThresholds(Double_t thresh, Double_t sigma)
        {fThresh=thresh; fSigma=sigma;}
     // Get Threshold and noise + threshold fluctuations parameter values
-    virtual  void   Thresholds(Float_t &thresh, Float_t &sigma) const
+    virtual  void   Thresholds(Double_t &thresh, Double_t &sigma) const
        {thresh=fThresh; sigma=fSigma;}
+
     // set coupling parameters
-    virtual  void   SetNoiseParam(Float_t col, Float_t row)
-       {fCouplCol=col; fCouplRow=row;}   
+    virtual  void   SetCouplingParam(Double_t col, Double_t row)
+        {fCouplCol=col; fCouplRow=row;}   
     // get coupling parameters
-    virtual  void   GetNoiseParam(Float_t &col, Float_t &row) const 
-       {col=fCouplCol; row=fCouplRow;}
+    virtual  void   GetCouplingParam(Double_t &col, Double_t &row) const 
+        {col=fCouplCol; row=fCouplRow;}
 
-//Declaration of member functions peculiar to this class
+    //Returns just baseline value
+    Double_t GetBaseline() const {return fBaseline;}
+    // Set noise and baseline in one (abstract method of AliITSresponse)
+    virtual void SetNoiseParam(Double_t n,Double_t b)
+        {fNoise = n;fBaseline = b;}
+    // Get noise and baseline in one (abstract method of AliITSresponse)
+    virtual void GetNoiseParam(Double_t &n,Double_t &b) const
+        {n =fNoise;b = fBaseline;}
+    // Returns just noise value
+    Double_t GetNoise() const {return fNoise;} 
+    //Declaration of member functions peculiar to this class
+    // Applies a random noise and addes the baseline
+    Double_t ApplyBaselineAndNoise() const {return fBaseline+
+                                               fNoise*gRandom->Gaus();}
+
+    //Declaration of member functions peculiar to this class
     // Sets the fraction of Dead SPD Pixels
-    void SetFractionDead(Float_t d=0.01){ fDeadPixels = d;}
+    void SetFractionDead(Double_t d=0.01){ fDeadPixels = d;}
     // Retruns the fraction of Dead SPD Pixels
-    Float_t GetFractionDead() const {return fDeadPixels;}
+    Double_t GetFractionDead() const {return fDeadPixels;}
+    // Returns a logical if a pixels is dead or not
+    Bool_t IsPixelDead(Int_t mod,Int_t ix,Int_t iz) const ;
 
     //abstract methods in AliITSresponse not implemented in this class
-    virtual void    SetDriftSpeed(Float_t /* p1 */)
-      {NotImplemented("SetDriftSpeed");}
-    virtual Float_t DriftSpeed() const 
-      {NotImplemented("DrifSpeed"); return 0.;}
+    virtual void SetDiffCoeff(Double_t,Double_t)
+      {NotImplemented("GiveCompressParam");}
+    virtual void DiffCoeff(Double_t &,Double_t &)const
+      {NotImplemented("GiveCompressParam");}
     virtual void    GiveCompressParam(Int_t *) const
       {NotImplemented("GiveCompressParam");}
-    virtual void   SetElectronics(Int_t /* i */) 
-                    {NotImplemented("SetElectronics");}
-    virtual Int_t Electronics() const {NotImplemented("Electronics"); return 0;}
-    virtual void SetMaxAdc(Float_t /* adc */) {NotImplemented("SetMaxAdc");}
-    virtual Float_t MaxAdc() const {NotImplemented("MaxAdc"); return 0.;}
-    virtual void    SetDynamicRange(Float_t /*dr */) 
-      {NotImplemented("SetDynamicRange");}
-    virtual Float_t DynamicRange() const 
-      {NotImplemented("DynamicRange"); return 0.;}
-    virtual void    SetChargeLoss(Float_t /* cl */)
-      {NotImplemented("SetChargeLoss"); }
-    virtual Float_t ChargeLoss() const 
-      {NotImplemented("ChargeLoss"); return 0.;}
-    virtual  void   SetDetParam(Float_t *)
+    virtual  void   SetDetParam(Double_t *)
       {NotImplemented("SetDetParam");}
-    virtual void   GetDetParam(Float_t *) const 
+    virtual void   GetDetParam(Double_t *) const 
       {NotImplemented("GetDetParam");}
     virtual  void   SetNDetParam(Int_t /* n */)
       {NotImplemented("SetNDetParam");}
@@ -79,27 +77,28 @@ class AliITSresponseSPD :  public AliITSresponse {
       {NotImplemented("SetZeroSupp");}
     virtual const char *ZeroSuppOption() const 
       {NotImplemented("ZeroSuppression"); return "";}
-    virtual void    SetNSigmaIntegration(Float_t)
+    virtual void    SetNSigmaIntegration(Double_t)
       {NotImplemented("SetNSigmaIntegration");}
-    virtual Float_t NSigmaIntegration() const
+    virtual Double_t NSigmaIntegration() const
       {NotImplemented("NSigmaIntegration"); return 0.;}
     virtual void    SetNLookUp(Int_t) 
       {NotImplemented("SetNLookUp");}
-    virtual void    SetSigmaSpread(Float_t, Float_t) 
+    virtual void    SetSigmaSpread(Double_t, Double_t) 
       {NotImplemented("SetSigmaSpread");}
-    virtual void    SigmaSpread(Float_t & /* p1 */,Float_t & /* p2 */) const 
+    virtual void    SigmaSpread(Double_t & /* p1 */,Double_t & /* p2 */) const 
       {NotImplemented("SigmaSpread");}
 
  protected:
-    static const Float_t fgkDiffCoeffDefault; //default for fDiffCoeff
-    static const Float_t fgkThreshDefault; //default for fThresh
-    static const Float_t fgkSigmaDefault; //default for fSigma
-    Float_t fDiffCoeff;       // Sigma diffusion coefficient (not used) 
-    Float_t fThresh;          // Threshold value
-    Float_t fSigma;           // Noise + threshold fluctuations value
-    Float_t fCouplCol;        // Coupling probability along a column
-    Float_t fCouplRow;        // Coupling probability along a row
-    Float_t fDeadPixels;      // the fraction of dead pixels
+    static const Double_t fgkDiffCoeffDefault; //default for fDiffCoeff
+    static const Double_t fgkThreshDefault; //default for fThresh
+    static const Double_t fgkSigmaDefault; //default for fSigma
+    Double_t fBaseline;        // Base-line value
+    Double_t fNoise;           // Gaussian noise scale
+    Double_t fThresh;          // Threshold value
+    Double_t fSigma;           // Noise + threshold fluctuations value
+    Double_t fCouplCol;        // Coupling probability along a column
+    Double_t fCouplRow;        // Coupling probability along a row
+    Double_t fDeadPixels;      // the fraction of dead pixels
 
 
     ClassDef(AliITSresponseSPD,2) // SPD response
diff --git a/ITS/AliITSresponseSPDdubna.cxx b/ITS/AliITSresponseSPDdubna.cxx
deleted file mode 100644 (file)
index a3f5cbd..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/**************************************************************************
- * 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.                  *
- **************************************************************************/
-
-#include<Riostream.h>
-#include "AliITSresponseSPDdubna.h"
-//////////////////////////////////////////////////////
-//  Response class for set:ITS                      //
-//  Specific subdetector implementation for         //
-//  Silicon pixels                                  //
-//  This is and alternative version                 //
-//  to the default version                          //
-////////////////////////////////////////////////////// 
-const Float_t AliITSresponseSPDdubna::fgkNoiseDefault = 200.;
-const Float_t AliITSresponseSPDdubna::fgkThresholdDefault = 2000.;
-
-//___________________________________________
-ClassImp(AliITSresponseSPDdubna)       
-
-AliITSresponseSPDdubna::AliITSresponseSPDdubna() : AliITSresponse(){
-   // Default constructor
-   // Inputs:
-   //    none.
-   // Outputs:
-   //    none.
-   // Return:
-   //    A default constructed AliITSresponseSPD class
-
-   SetNoiseParam(fgkNoiseDefault,0.);  // fNoise, fBaseline
-   SetThresholds(fgkThresholdDefault,0.);   // fThreshold
-   SetCouplings();   // fCouplCol, fCouplRow
-   SetFractionDeadPixels(); // fDeadPixels
-   SetDataType();    // fDataType
-}
-//_________________________________________________________________________
-Bool_t AliITSresponseSPDdubna::IsPixelDead(Int_t mod,Int_t ix,Int_t iz) const {
-  // Returns kTRUE if pixel is dead
-  // Inputs:
-  //    Int_t mod      module number
-  //    Int_t ix       x pixel number
-  //    Int_t iz       z pixel number
-  // Outputs:
-  //    none.
-  // Return:
-  //    kFALSE if pixel is alive, or kTRUE if pixel is dead.
-  Bool_t  dead = kFALSE;
-  Int_t   seed;
-  static TRandom ran; // don't use gRandom. This must not be a true randome
-  // sequence. These sequence must be random one and then fully repetable.
-
-  seed = mod*256*256+iz*256+ix;
-  ran.SetSeed(seed);
-  if(ran.Rndm(0)<fDeadPixels) dead = kTRUE;
-  return dead;
-}
-
-//----------------------------------------------------------------------
-void AliITSresponseSPDdubna::Print(ostream *os) const{
-    // Standard output format for this class.
-    // Inputs:
-    //    ostream *os  Pointer to the output stream
-    // Outputs:
-    //    none:
-    // Return:
-    //    none.
-
-    AliITSresponse::Print(os);
-    *os << fNoise << " " << fBaseline << " " << fCouplCol << " ";
-    *os << fCouplRow << " "<< fThreshold << " " << fDeadPixels << " ";
-    *os << fDataType;
-//    *os << " " << endl;
-    return;
-}
-
-//----------------------------------------------------------------------
-void AliITSresponseSPDdubna::Read(istream *is) {
-    // Standard input format for this class.
-    // Inputs:
-    //    ostream *os  Pointer to the output stream
-    // Outputs:
-    //    none:
-    // Return:
-    //    none.
-
-    AliITSresponse::Read(is);
-    *is >> fNoise >> fBaseline >> fCouplCol >> fCouplRow;
-    *is >> fThreshold >> fDeadPixels >> fDataType;
-    return;
-}
-//----------------------------------------------------------------------
-
-ostream &operator<<(ostream &os,AliITSresponseSPDdubna &p){
-    // Standard output streaming function.
-    // Inputs:
-    //    ostream *os  Pointer to the output stream
-    // Outputs:
-    //    none:
-    // Return:
-    //    none.
-
-    p.Print(&os);
-    return os;
-}
-
-//----------------------------------------------------------------------
-istream &operator>>(istream &is,AliITSresponseSPDdubna &r){
-    // Standard input streaming function.
-    // Inputs:
-    //    ostream *os  Pointer to the output stream
-    // Outputs:
-    //    none:
-    // Return:
-    //    none.
-
-    r.Read(&is);
-    return is;
-}
-//----------------------------------------------------------------------
-
diff --git a/ITS/AliITSresponseSPDdubna.h b/ITS/AliITSresponseSPDdubna.h
deleted file mode 100644 (file)
index 5d99e0c..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef ALIITSRESPONSESPDDUBNA_H
-#define ALIITSRESPONSESPDDUBNA_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-
-#include <TRandom.h>
-class TString;
-
-
-#include "AliITSresponse.h"
-
-//----------------------------------------------
-// ITS response class for SPD
-class AliITSresponseSPDdubna : public AliITSresponse {
- public:
-  AliITSresponseSPDdubna();
-  virtual ~AliITSresponseSPDdubna(){}// destructror
-//abstract methods in AliITSresponse not implemented in this class
-    virtual void    GiveCompressParam(Int_t *) const
-      {NotImplemented("GiveCompressParam");}
-    virtual void    SetDriftSpeed(Float_t /* p1 */)
-      {NotImplemented("SetDriftSpeed");}
-    virtual Float_t DriftSpeed() const 
-      {NotImplemented("DrifSpeed"); return 0.;}
-    virtual void   SetElectronics(Int_t /* i */) 
-                    {NotImplemented("SetElectronics");}
-    virtual Int_t Electronics() const {NotImplemented("Electronics"); return 0;}
-    virtual void SetMaxAdc(Float_t /* adc */) {NotImplemented("SetMaxAdc");}
-    virtual Float_t MaxAdc() const {NotImplemented("MaxAdc"); return 0.;}
-    virtual void    SetDynamicRange(Float_t /*dr */) 
-      {NotImplemented("SetDynamicRange");}
-    virtual Float_t DynamicRange() const 
-      {NotImplemented("DynamicRange"); return 0.;}
-    virtual void    SetChargeLoss(Float_t /* cl */)
-      {NotImplemented("SetChargeLoss"); }
-    virtual Float_t ChargeLoss() const 
-      {NotImplemented("ChargeLoss"); return 0.;}
-    virtual void    SetDiffCoeff(Float_t /* a */, Float_t /* b */)
-      {NotImplemented("SetDiffCoeff");}
-    virtual void    DiffCoeff(Float_t & /* a */,Float_t & /* b */) const
-      {NotImplemented("DiffCoeff");}
-    virtual  void   SetDetParam(Float_t *)
-      {NotImplemented("SetDetParam");}
-    virtual void   GetDetParam(Float_t *) const 
-      {NotImplemented("GetDetParam");}
-    virtual  void   SetNDetParam(Int_t /* n */)
-      {NotImplemented("SetNDetParam");}
-    virtual Int_t  NDetParam() const
-      {NotImplemented("NDetParam"); return 0;}
-    virtual void   SetParamOptions(const char* /* a */,const char* /* b */)
-      {NotImplemented("SetParamOptions");}
-    virtual void   ParamOptions(char *,char*) const
-      {NotImplemented("ParamOptions");} 
-    virtual void   SetZeroSupp(const char*)
-      {NotImplemented("SetZeroSupp");}
-    virtual const char *ZeroSuppOption() const 
-      {NotImplemented("ZeroSuppression"); return "";}
-    virtual void    SetNSigmaIntegration(Float_t)
-      {NotImplemented("SetNSigmaIntegration");}
-    virtual Float_t NSigmaIntegration() const
-      {NotImplemented("NSigmaIntegration"); return 0.;}
-    virtual void    SetNLookUp(Int_t) 
-      {NotImplemented("SetNLookUp");}
-    virtual void    SetSigmaSpread(Float_t, Float_t) 
-      {NotImplemented("SetSigmaSpread");}
-    virtual void    SigmaSpread(Float_t & /* p1 */,Float_t & /* p2 */) const 
-      {NotImplemented("SigmaSpread");}
-
-// Implementation of virtual member functions declared in AliITSresponse 
-  // set noise and baseline
-  virtual void SetNoiseParam(Float_t n, Float_t b) {
-    fNoise=n; fBaseline=b;}
-  virtual void GetNoiseParam(Float_t &n, Float_t &b) const {
-    n=fNoise; b=fBaseline;} // get noise and baseline
-  // Zero-suppression option threshold
-  virtual void SetThresholds(Float_t th, Float_t /* dum */) {fThreshold=th;}
-  virtual void Thresholds(Float_t & thr, Float_t & /*dum */) const
-    {thr = fThreshold;}
-
-  // Prints out the content of this class in ASCII format.
-  virtual void Print(ostream *os) const;
-
-  // Reads in the content of this class in the format of Print
-  virtual void Read(istream *is);
-
-//Declaration of member functions peculiar to this class
-  // Applies a random noise and addes the baseline
-  Float_t ApplyBaselineAndNoise() const {return fBaseline+
-                                                 fNoise*gRandom->Gaus();}
-  //Returns just baseline value
-  Float_t GetBaseline() const {return fBaseline;}
-  // Returns just noise value
-  Float_t GetNoise() const {return fNoise;} 
-  // Get zero-suppression threshold
-  Float_t GetThreshold() const {return fThreshold;}
-  // Sets the coupling probabilities for columns and rows
-  void SetCouplings(Float_t ccol=0.,Float_t crow=0.){fCouplCol=ccol;
-                                                       fCouplRow=crow;}
-  // Gets the coupling probabilities for columns and rows
-  void GetCouplings(Float_t &ccol,Float_t &crow) const 
-              {ccol=fCouplCol; crow=fCouplRow;}
-  // Returns the fraction of dead pixels
-  Float_t GetFractionDeadPixels() const {return fDeadPixels;}
-  // Sets the fraction of dead pixels
-  void SetFractionDeadPixels(Float_t f=0.01){fDeadPixels = f;}
-  // Returns a logical if a pixels is dead or not
-  Bool_t IsPixelDead(Int_t mod,Int_t ix,Int_t iz) const ;
-
-  ClassDef(AliITSresponseSPDdubna,3) // SPD response
-    
- protected:
-  static const Float_t fgkNoiseDefault; // default for fNoise
-  static const Float_t fgkThresholdDefault; //default for fThreshold
-  Float_t fNoise;           // Noise value
-  Float_t fBaseline;        // Baseline value
-  Float_t fCouplCol;        // Coupling Probability along columns
-  Float_t fCouplRow;        // Coupling Probability along rows
-  Float_t fThreshold;       // Zero-Suppression threshold
-  Float_t fDeadPixels;      // Fraction of dead pixels.
-};
-// Input and output function for standard C++ input/output.
-ostream& operator<<(ostream &os,AliITSresponseSPDdubna &source);
-istream& operator>>(istream &os,AliITSresponseSPDdubna &source);
-
-#endif
index b0a0a70..e5ba79e 100644 (file)
 //                                                  //
 //////////////////////////////////////////////////////
 
-const Float_t AliITSresponseSSD::fgkDiffCoeffDefault = 0.;
+const Double_t AliITSresponseSSD::fgkDiffCoeffDefault = 0.;
 const TString AliITSresponseSSD::fgkOption1Default = "";
 const TString AliITSresponseSSD::fgkOption2Default = "";
-const Float_t AliITSresponseSSD::fgkNoiseNDefault = 625.;
-const Float_t AliITSresponseSSD::fgkNoisePDefault = 420.;
+const Double_t AliITSresponseSSD::fgkNoiseNDefault = 625.;
+const Double_t AliITSresponseSSD::fgkNoisePDefault = 420.;
 const Int_t AliITSresponseSSD::fgkNParDefault = 6;
-const Float_t AliITSresponseSSD::fgkSigmaPDefault = 3.;
-const Float_t AliITSresponseSSD::fgkSigmaNDefault = 2.;
+const Double_t AliITSresponseSSD::fgkSigmaPDefault = 3.;
+const Double_t AliITSresponseSSD::fgkSigmaNDefault = 2.;
 
 ClassImp(AliITSresponseSSD)
 
@@ -60,7 +60,7 @@ AliITSresponseSSD::AliITSresponseSSD(const char *dataType){
     SetParamOptions(fgkOption1Default.Data(),fgkOption2Default.Data());
     SetNDetParam(fgkNParDefault);   // Sets fNPar=6 by default.
     SetADCpereV();
-    fDetPar = new Float_t[fNPar];
+    fDetPar = new Double_t[fNPar];
     if (fNPar==6) {
        fDetPar[0]=10.;
        fDetPar[1]=5.;
@@ -104,7 +104,7 @@ AliITSresponseSSD::AliITSresponseSSD(const AliITSresponseSSD &src) :
     *this = src;
 }
 //______________________________________________________________________
-void AliITSresponseSSD::SetDetParam(Float_t  *par){
+void AliITSresponseSSD::SetDetParam(Double_t  *par){
     // set det param
     Int_t i;
 
@@ -114,7 +114,7 @@ void AliITSresponseSSD::SetDetParam(Float_t  *par){
     } // end for i
 }
 //______________________________________________________________________
-void AliITSresponseSSD::GetDetParam(Float_t  *par) const {
+void AliITSresponseSSD::GetDetParam(Double_t  *par) const {
     // get det param
     Int_t i;
 
index 770152b..0d442ce 100644 (file)
@@ -15,19 +15,19 @@ class AliITSresponseSSD : public AliITSresponse {
     virtual ~AliITSresponseSSD();
 
 // Implementation of virtual member functions declared in AliITSresponse 
-    virtual void    SetDiffCoeff(Float_t p1,Float_t /* dummy */) {
+    virtual void    SetDiffCoeff(Double_t p1,Double_t /* dummy */) {
        // Diffusion coefficient
       fDiffCoeff=p1; }
-    virtual void    DiffCoeff(Float_t &diffc,Float_t & /* dummy */) const {
+    virtual void    DiffCoeff(Double_t &diffc,Double_t & /* dummy */) const {
        // Get diffusion coefficient
        diffc= fDiffCoeff;
     }
 
-    virtual  void   SetNoiseParam(Float_t np, Float_t nn) {
+    virtual  void   SetNoiseParam(Double_t np, Double_t nn) {
        // set noise par
        fNoiseP=np; fNoiseN=nn;
     }
-    virtual void    GetNoiseParam(Float_t &np, Float_t &nn) const {
+    virtual void    GetNoiseParam(Double_t &np, Double_t &nn) const {
        // get noise par
        np=fNoiseP; nn=fNoiseN;
     }
@@ -48,21 +48,21 @@ class AliITSresponseSSD : public AliITSresponse {
        fNPar=npar;
     }
 
-    virtual  void   SetDetParam(Float_t *par);
+    virtual  void   SetDetParam(Double_t *par);
 
     // Parameters options
     virtual Int_t   NDetParam() const {
        // number of param
        return fNPar;
     }
-    virtual void    GetDetParam(Float_t *dpar) const; 
+    virtual void    GetDetParam(Double_t *dpar) const; 
 
-    virtual void    SetSigmaSpread(Float_t p1, Float_t p2) {
+    virtual void    SetSigmaSpread(Double_t p1, Double_t p2) {
        // Set sigmas of the charge spread function: Pside-Nside
        // square of (microns)
        fSigmaP=p1; fSigmaN=p2;
     }
-    virtual void    SigmaSpread(Float_t &sP, Float_t &sN) const {
+    virtual void    SigmaSpread(Double_t &sP, Double_t &sN) const {
        // Get sigmas for the charge spread 
        sP=fSigmaP; sN=fSigmaN;
     }
@@ -72,7 +72,7 @@ class AliITSresponseSSD : public AliITSresponse {
 // Sets electron-hole pairs to ADC value conversion factor
 // are rather arbitrary (need tuning)
 // minimum ionizing particle--> ~30000 pairs--> ADC channel 50
-    void SetADCpereV(Float_t a=50./30000.0){fADCpereV = a;}
+    void SetADCpereV(Double_t a=50./30000.0){fADCpereV = a;}
 // Converts electron-hole pairs to
 // ADC value conversion factor are rather arbitrary (need tuning)
 // minimum ionizing particle--> ~30000 pairs--> ADC channel 50
@@ -82,60 +82,49 @@ class AliITSresponseSSD : public AliITSresponse {
        return ((Int_t) DEvToADC(eV)); }
 
  //abstract methods in AliITSresponse not implemented in this class
-    virtual void    SetDriftSpeed(Float_t /* p1 */)
+    virtual void    SetDriftSpeed(Double_t /* p1 */)
       {NotImplemented("SetDriftSpeed");}
-    virtual Float_t DriftSpeed() const 
+    virtual Double_t DriftSpeed() const 
       {NotImplemented("DrifSpeed"); return 0.;}
-    virtual void   SetElectronics(Int_t /* i */) 
-                    {NotImplemented("SetElectronics");}
-    virtual Int_t Electronics() const {NotImplemented("Electronics"); return 0;}
     virtual void    GiveCompressParam(Int_t *) const
       {NotImplemented("GiveCompressParam");}
-    virtual void SetMaxAdc(Float_t /* adc */) {NotImplemented("SetMaxAdc");}
-    virtual Float_t MaxAdc() const {NotImplemented("MaxAdc"); return 0.;}
-    virtual void    SetDynamicRange(Float_t /*dr */) 
-      {NotImplemented("SetDynamicRange");}
-    virtual Float_t DynamicRange() const 
-      {NotImplemented("DynamicRange"); return 0.;}
-    virtual void    SetChargeLoss(Float_t /* cl */)
-      {NotImplemented("SetChargeLoss"); }
-    virtual Float_t ChargeLoss() const 
+    virtual Double_t ChargeLoss() const 
       {NotImplemented("ChargeLoss"); return 0.;}
-    virtual void   SetThresholds(Float_t /* a */, Float_t /* b */)
+    virtual void   SetThresholds(Double_t /* a */, Double_t /* b */)
       {NotImplemented("SetThresholds");}
-    virtual void   Thresholds(Float_t & /* a */, Float_t & /* b */) const 
+    virtual void   Thresholds(Double_t & /* a */, Double_t & /* b */) const 
       {NotImplemented("Thresholds");}
     virtual void   SetZeroSupp(const char*)
       {NotImplemented("SetZeroSupp");}
     virtual const char *ZeroSuppOption() const 
       {NotImplemented("ZeroSuppression"); return "";}
-    virtual void    SetNSigmaIntegration(Float_t)
+    virtual void    SetNSigmaIntegration(Double_t)
       {NotImplemented("SetNSigmaIntegration");}
-    virtual Float_t NSigmaIntegration() const
+    virtual Double_t NSigmaIntegration() const
       {NotImplemented("NSigmaIntegration"); return 0.;}
     virtual void    SetNLookUp(Int_t) 
       {NotImplemented("SetNLookUp");}
   
  protected:
-    static const Float_t fgkDiffCoeffDefault; //default for fDiffCoeff
+    static const Double_t fgkDiffCoeffDefault; //default for fDiffCoeff
     static const TString fgkOption1Default; // default for fOption1
     static const TString fgkOption2Default; // default for fOption2
-    static const Float_t fgkNoiseNDefault; // default for fNoiseN
-    static const Float_t fgkNoisePDefault; // default for fNoiseP
+    static const Double_t fgkNoiseNDefault; // default for fNoiseN
+    static const Double_t fgkNoisePDefault; // default for fNoiseP
     static const Int_t fgkNParDefault; // default for fNPar
-    static const Float_t fgkSigmaPDefault; //default for fSigmaP
-    static const Float_t fgkSigmaNDefault; //default for fSigmaP
+    static const Double_t fgkSigmaPDefault; //default for fSigmaP
+    static const Double_t fgkSigmaNDefault; //default for fSigmaP
     Int_t   fNPar;            // Number of detector param 
-    Float_t *fDetPar;         //[fNPar] Array of parameters
+    Double_t *fDetPar;         //[fNPar] Array of parameters
 
-    Float_t fNoiseP;          // Noise on Pside
-    Float_t fNoiseN;          // Noise on Nside
+    Double_t fNoiseP;          // Noise on Pside
+    Double_t fNoiseN;          // Noise on Nside
 
-    Float_t fSigmaP;          // Sigma charge spread on Pside
-    Float_t fSigmaN;          // Sigma charge spread on Nside
-    Float_t fDiffCoeff;       // Diffusion Coefficient
+    Double_t fSigmaP;          // Sigma charge spread on Pside
+    Double_t fSigmaN;          // Sigma charge spread on Nside
+    Double_t fDiffCoeff;       // Diffusion Coefficient
 
-    Float_t fADCpereV;        // Constant to convert eV to ADC.
+    Double_t fADCpereV;        // Constant to convert eV to ADC.
 
     TString fOption1;         // Simulate invalid strips option
     TString fOption2;         // Not used for the moment
index 474d7c5..d1472fd 100644 (file)
@@ -43,7 +43,7 @@ public TObject {
     virtual void    GetPadTxz(Float_t &,Float_t &) const = 0;
     // Transformation from Geant cm detector center local coordinates
     // to detector segmentation/cell coordiantes starting from (0,0).
-    virtual void    LocalToDet(Float_t,Float_t,Int_t &,Int_t &) const = 0;
+    virtual Bool_t LocalToDet(Float_t,Float_t,Int_t &,Int_t &) const = 0;
     // Transformation from detector segmentation/cell coordiantes starting
     // from (0,0) to Geant cm detector center local coordinates.
     virtual void    DetToLocal(Int_t,Int_t,Float_t &,Float_t &) const = 0;
index 32c8f34..34d559f 100644 (file)
@@ -236,7 +236,8 @@ void AliITSsegmentationSDD::PrintDefaultParameters() const {
 }
 
 //______________________________________________________________________
-void AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const {
+Bool_t AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,
+                                         Int_t &ix,Int_t &iz) const {
 // Transformation from Geant detector centered local coordinates (cm) to
 // time bucket numbers ix and anode number iz.
 // Input:
@@ -275,11 +276,11 @@ void AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz)
     dz = -0.5*kconv*Dz(); // lower left edge in cm.
     if(x<dx || x>-dx) {
       Warning("LocalToDet","input argument %f out of range (%f, %f)",x,dx,-dx);
-      return; // outside of defined volume.
+      return kFALSE; // outside of defined volume.
     }
     if(z<dz || z>-dz) {
       Warning("LocalToDet","input argument %f out of range (%f, %f)",z,dz,-dz);
-      return; // outside of defined volume.
+      return kFALSE; // outside of defined volume.
     }
     tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
     if(x>0) dx = -(dx + x)/tb; // distance from + side in time bin units
@@ -288,7 +289,7 @@ void AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz)
     ix = (Int_t) dx;   // time bin
     iz = (Int_t) dz;   // anode
     if(x>0) iz += Npz()/2; // if x>0 then + side anodes values.
-    return; // Found ix and iz, return.
+    return kTRUE; // Found ix and iz, return.
 }
 //______________________________________________________________________
 void AliITSsegmentationSDD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
index eff72a4..5d2b653 100644 (file)
@@ -43,7 +43,7 @@ public AliITSsegmentation {
     virtual void    GetPadTxz(Float_t &x ,Float_t &z) const;
     // Transformation from Geant cm detector center local coordinates
     // to detector segmentation/cell coordiantes starting from (0,0).
-    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const;
+    virtual Bool_t  LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const;
     // Transformation from detector segmentation/cell coordiantes starting
     // from (0,0) to Geant cm detector center local coordinates.
     virtual void    DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const;
index f032bef..1fcf0a4 100644 (file)
@@ -379,19 +379,24 @@ Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]) con
     Zlist[7]=iZ-1;
 }
 //______________________________________________________________________
-void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const {
-// Transformation from Geant detector centered local coordinates (cm) to
-// Pixel cell numbers ix and iz.
-// Input:
-// Float_t   x        detector local coordinate x in cm with respect to the
-//                    center of the sensitive volume.
-// Float_t   z        detector local coordinate z in cm with respect to the
-//                    center of the sensitive volulme.
-// Output:
-// Int_t    ix        detector x cell coordinate. Has the range 0<=ix<fNpx.
-// Int_t    iz        detector z cell coordinate. Has the range 0<=iz<fNpz.
-//   A value of -1 for ix or iz indecates that this point is outside of the
-// detector segmentation as defined.
+Bool_t AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,
+                                         Int_t &ix,Int_t &iz) const {
+    // Transformation from Geant detector centered local coordinates (cm) to
+    // Pixel cell numbers ix and iz.
+    // Input:
+    //    Float_t   x        detector local coordinate x in cm with respect to
+    //                       the center of the sensitive volume.
+    //    Float_t   z        detector local coordinate z in cm with respect to
+    //                       the center of the sensitive volulme.
+    // Output:
+    //    Int_t    ix        detector x cell coordinate. Has the range 
+    //                       0<=ix<fNpx.
+    //    Int_t    iz        detector z cell coordinate. Has the range 
+    //                       0<=iz<fNpz.
+    // Return:
+    //   kTRUE if point x,z is inside sensitive volume, kFALSE otherwise.
+    //   A value of -1 for ix or iz indecates that this point is outside of the
+    //   detector segmentation as defined.
     Int_t i,j;
     Float_t dx,dz;
     const Float_t kconv = 1.0E-04; // converts microns to cm.
@@ -400,21 +405,21 @@ void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz)
     dz = -0.5*kconv*Dz();
     ix = -1;
     iz = -1;
-    if(x<dx) return; // outside x range.
-    if(z<dz) return; // outside z range.
+    if(x<dx) return kFALSE; // outside x range.
+    if(z<dz) return kFALSE; // outside z range.
     for(i=0;i<Npx();i++){
        dx += kconv*fCellSizeX[i];
        if(x<dx) break;
     } // end for i
-    if(i>=Npx()) return; // outside x range.
+    if(i>=Npx()) return kFALSE; // outside x range.
     for(j=0;j<Npz();j++){
        dz += kconv*fCellSizeZ[j];
        if(z<dz) break;
     } // end for j
-    if(j>=Npz()) return; // outside z range.
+    if(j>=Npz()) return kFALSE; // outside z range.
     ix = i;
     iz = j;
-    return; // Found ix and iz, return.
+    return kTRUE; // Found ix and iz, return.
 }
 //______________________________________________________________________
 void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
index f1c69a1..35fc84a 100644 (file)
@@ -37,7 +37,7 @@ public AliITSsegmentation {
     virtual void    GetPadTxz(Float_t &x ,Float_t &z) const;
     // Transformation from Geant cm detector center local coordinates
     // to detector segmentation/cell coordiantes starting from (0,0).
-    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const;
+    virtual Bool_t  LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const;
     // Transformation from detector segmentation/cell coordiantes starting
     // from (0,0) to Geant cm detector center local coordinates.
     virtual void    DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const;
index 679d3ee..6dba076 100644 (file)
@@ -212,7 +212,7 @@ void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z) c
     return;   
 }
 //______________________________________________________________________
-void AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
+Bool_t AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
                                       Int_t &iP,Int_t &iN) const {
     // Transformation from Geant cm detector center local coordinates
     // to detector P and N side strip numbers..
@@ -247,7 +247,7 @@ void AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
     // Now for N side)
     iN = (Int_t) z;
     if(iN<0 || iN>=fNstrips) iN=-1; // strip number must be in range.
-    return;
+    return kTRUE;
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN,
index 3fb1793..7433200 100644 (file)
@@ -45,7 +45,7 @@ public AliITSsegmentation {
     virtual void    GetPadTxz(Float_t &x , Float_t &z) const;
     // Transformation from Geant cm detector center local coordinates
     // to detector P and N side strip numbers..
-    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &iP,Int_t &iN) const;
+    virtual Bool_t  LocalToDet(Float_t x,Float_t z,Int_t &iP,Int_t &iN) const;
     // Transformation from detector segmentation/cell coordiantes starting
     // from 0. iPN=0 for P side and 1 for N side strip. Returned is z=0.0
     // and the corresponding x value..
index f8b301f..3f61040 100644 (file)
 
 ClassImp(AliITSsimulation)
 
-AliITSsimulation::AliITSsimulation(){
-    // constructor
-    fSegmentation = 0;
-    fResponse     = 0;
-    fpList        = 0;
-    fModule       = 0;
-    fEvent        = 0;
-    SetDebug(kFALSE);
+//______________________________________________________________________
+AliITSsimulation::AliITSsimulation(): TObject(),
+fResponse(0),
+fSegmentation(0),
+fpList(0),
+fModule(0),
+fEvent(0),
+fDebug(0){
+    // Default constructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    a default constructed AliITSsimulation class
+}
+//______________________________________________________________________
+AliITSsimulation::AliITSsimulation(AliITSsegmentation *seg,
+                                   AliITSresponse *res): TObject(),
+fResponse(res),
+fSegmentation(seg),
+fpList(0),
+fModule(0),
+fEvent(0),
+fDebug(0){
+    // Default constructor
+    // Inputs:
+    //    AliITSsegmentation *seg  Segmentation class to be used
+    //    AliITSresponse     *res  Response class to be used.
+    // Outputs:
+    //    none.
+    // Return:
+    //    a default constructed AliITSsimulation class
 }
 //__________________________________________________________________________
 AliITSsimulation::~AliITSsimulation(){
     // destructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
+
     fSegmentation = 0; // local copies of pointer, do not delete
     fResponse     = 0; // local copies of pointer, do not delete
     delete fpList;
 }
 //__________________________________________________________________________
 AliITSsimulation::AliITSsimulation(const AliITSsimulation &s) : TObject(s){
-    //     Copy Constructor 
+    //     Copy Constructor
+    // Inputs:
+    //    const AliITSsimulation &s  simulation class to copy from
+    // Outputs:
+    //    none.
+    // Return:
+    //    a standard constructed AliITSsimulation class with values the same
+    //    as that of s.
  
     *this = s;
     return;
@@ -47,6 +86,13 @@ AliITSsimulation::AliITSsimulation(const AliITSsimulation &s) : TObject(s){
 //_________________________________________________________________________
 AliITSsimulation&  AliITSsimulation::operator=(const AliITSsimulation &s){
     //    Assignment operator
+    // Inputs:
+    //    const AliITSsimulation &s  simulation class to copy from
+    // Outputs:
+    //    none.
+    // Return:
+    //    a standard constructed AliITSsimulation class with values the same
+    //    as that of s.
 
     if(&s == this) return *this;
     this->fResponse     = s.fResponse; 
@@ -59,6 +105,14 @@ AliITSsimulation&  AliITSsimulation::operator=(const AliITSsimulation &s){
 //______________________________________________________________________
 Bool_t AliITSsimulation::AddSDigitsToModule(TClonesArray *pItemA,Int_t mask ){
     // Add Summable digits to module maps.
+    // Inputs:
+    //    TClonesArray *pItemA  Array of AliITSpListItems (SDigits).
+    //    Int_t         mask    Track number off set value (see 
+    //                          AliITSpList::AddItemTo).
+    // Outputs:
+    //    none.
+    // Return:
+    //    kTRUE if there is a signal >0 else kFALSE
     Int_t nItems = pItemA->GetEntries();
     Bool_t sig = kFALSE;
  
@@ -67,11 +121,11 @@ Bool_t AliITSsimulation::AddSDigitsToModule(TClonesArray *pItemA,Int_t mask ){
         AliITSpListItem * pItem = (AliITSpListItem *)(pItemA->At( i ));
         if( pItem->GetModule() != fModule ) {
             Error( "AddSDigitsToModule","Error reading, SDigits module %d "
-                  "!= current module %d: exit",
-                  pItem->GetModule(), fModule );
+                   "!= current module %d: exit",
+                   pItem->GetModule(), fModule );
             return sig;
         } // end if
-       if(pItem->GetSignal()>0.0 ) sig = kTRUE;
+        if(pItem->GetSignal()>0.0 ) sig = kTRUE;
         fpList->AddItemTo( mask, pItem );
     } // end for i
     return sig;
index 4b02971..329083d 100644 (file)
@@ -32,13 +32,17 @@ class TClonesArray;
 
 class AliITSsimulation : public TObject {
 
- public:
+  public:
     AliITSsimulation(); // Default constructor
+    // Standard constructor
+    AliITSsimulation(AliITSsegmentation *seg,AliITSresponse *res);
     virtual ~AliITSsimulation(); // destructor
     // copy constructor. See detector specific implementation.
     AliITSsimulation(const AliITSsimulation &source);
     // Assignment opporator. See detector specific implementation.
     virtual AliITSsimulation& operator=(const AliITSsimulation &source);
+    // Initialize simulation
+    virtual void Init() {};
 
     // *****************  Hits -> SDigits ******************
     // digitize module using the "slow" detector simulator creating
@@ -78,8 +82,12 @@ class AliITSsimulation : public TObject {
     virtual Int_t GetModuleNumber()const {return fModule;}// Gets Module number
     virtual void SetEventNumber(Int_t evnt){fEvent=evnt;} // Set Event number
     virtual Int_t GetEventNumber()const {return fEvent;}// Gets Event number
-    virtual Bool_t GetDebug() const {return fDebug;}
-    virtual void SetDebug(Bool_t db = kTRUE) {fDebug = db;}
+    // Sets the debug flag for debugging output
+    void SetDebug(Int_t level=5){fDebug=level;}
+    // Clears the debug flag so no debugging output will be generated
+    void SetNoDebug(){fDebug=0;}
+    // Returns the debug flag value
+    Bool_t GetDebug(Int_t level=1)const {return fDebug>=level;}
 
  protected:
     AliITSresponse      *fResponse;       //! response
@@ -87,9 +95,9 @@ class AliITSsimulation : public TObject {
     AliITSpList         *fpList;          //!
     Int_t                fModule;         //!
     Int_t                fEvent;          //!
-    Bool_t               fDebug;          //  debug flag
+    Int_t                fDebug;          //  debug flag
 
-  ClassDef(AliITSsimulation,2)  // Simulation base class 
+  ClassDef(AliITSsimulation,3)  // Simulation base class 
     
 };