LCOV - code coverage report
Current view: top level - ITS/ITSrec - AliITSreconstruction.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 102 1.0 %
Date: 2016-06-14 17:26:59 Functions: 1 14 7.1 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             :  
      16             : /* $Id$ */
      17             : /////////////////////////////////////////////////////////////////////////
      18             : //                                                                     //
      19             : // Class for ITS RecPoint reconstruction                               //
      20             : //                                                                     //
      21             : ////////////////////////////////////////////////////////////////////////
      22             : 
      23             : #include <TString.h>
      24             : #include "AliRun.h"
      25             : #include "AliRunLoader.h"
      26             : #include "AliITSDetTypeRec.h"
      27             : #include "AliITSLoader.h"
      28             : #include "AliITSreconstruction.h"
      29             : #include "AliITSgeom.h"
      30             : #include <iostream>
      31             : 
      32             : using std::endl;
      33             : using std::cout;
      34         116 : ClassImp(AliITSreconstruction)
      35             : 
      36             : //______________________________________________________________________
      37           0 : AliITSreconstruction::AliITSreconstruction():
      38           0 :  fInit(kFALSE),
      39           0 :  fEnt(0),
      40           0 :  fEnt0(0),
      41           0 :  fDetTypeRec(0x0),
      42           0 :  fDfArp(kFALSE),
      43           0 :  fITSgeom(0x0),
      44           0 :  fLoader(0x0),
      45           0 :  fRunLoader(0x0)
      46           0 : {
      47             :     // Default constructor.
      48             :     // Inputs:
      49             :     //  none.
      50             :     // Outputs:
      51             :     //   none.
      52             :     // Return:
      53             :     //    A zero-ed constructed AliITSreconstruction class.
      54           0 :     fDet[0] = fDet[1] = fDet[2] = kTRUE;
      55           0 : }
      56             : //______________________________________________________________________
      57             : 
      58           0 : AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
      59           0 :  fInit(kFALSE),
      60           0 :  fEnt(0),
      61           0 :  fEnt0(0),
      62           0 :  fDetTypeRec(0x0),
      63           0 :  fDfArp(kFALSE),
      64           0 :  fITSgeom(0x0),
      65           0 :  fLoader(0x0),
      66           0 :  fRunLoader(rl)
      67           0 : {
      68           0 :   fDet[0] = fDet[1] = fDet[2] = kTRUE;
      69           0 : }
      70             : //______________________________________________________________________
      71           0 : AliITSreconstruction::AliITSreconstruction(const char* filename):
      72           0 :  fInit(kFALSE),
      73           0 :  fEnt(0),
      74           0 :  fEnt0(0),
      75           0 :  fDetTypeRec(0x0),
      76           0 :  fDfArp(kFALSE),
      77           0 :  fITSgeom(0x0),
      78           0 :  fLoader(0x0),
      79           0 :  fRunLoader(0x0)
      80           0 : {
      81             :     // Standard constructor.
      82             :     // Inputs:
      83             :     //  const char* filename    filename containing the digits to be
      84             :     //                          reconstructed. If filename = 0 (nil)
      85             :     //                          then no file is opened but a file is
      86             :     //                          assumed to already be opened. This 
      87             :     //                          already opened file will be used.
      88             :     // Outputs:
      89             :     //   none.
      90             :     // Return:
      91             :     //    A standardly constructed AliITSreconstruction class.
      92             : 
      93           0 :     fDet[0] = fDet[1] = fDet[2] = kTRUE;
      94             : 
      95           0 :     fRunLoader = AliRunLoader::Open(filename);
      96           0 :     if (fRunLoader == 0x0)
      97             :      {
      98           0 :        Error("AliITSreconstruction","Can not load the session %s \n",filename);
      99             :        return;
     100             :      }
     101             : 
     102           0 : }
     103             : 
     104             : 
     105             : //______________________________________________________________________
     106           0 : AliITSreconstruction::~AliITSreconstruction(){
     107             :     //    A destroyed AliITSreconstruction class.
     108             :     
     109             :     //fITS      = 0;
     110           0 :     delete fRunLoader;
     111             :     
     112           0 : }
     113             : //______________________________________________________________________
     114             : Bool_t AliITSreconstruction::Init(){
     115             :     // Class Initilizer.
     116             :     // Inputs:
     117             :     //  none.
     118             :     // Outputs:
     119             :     //   none.
     120             :     // Return:
     121             :     //    kTRUE if no errors initilizing this class occurse else kFALSE
     122           0 :     Info("Init"," Init ITS reconstruction");
     123           0 :     if (fRunLoader == 0x0)
     124             :      {
     125           0 :        Error("Init","Run Loader is NULL");
     126           0 :        return kFALSE;
     127             :      }
     128             :     //  fRunLoader->LoadgAlice();
     129             :     //   fRunLoader->LoadHeader();  
     130             : 
     131           0 :     fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
     132           0 :     if(!fLoader) {
     133           0 :       Error("Init","ITS loader not found");
     134           0 :       fInit = kFALSE;
     135           0 :     }
     136             : 
     137             :     // Now ready to init.
     138             :  
     139             :     //fRunLoader->CdGAFile();
     140           0 :     fITSgeom = fLoader->GetITSgeom();
     141             : 
     142           0 :     fDetTypeRec = new AliITSDetTypeRec();
     143           0 :     fDetTypeRec->SetITSgeom(fITSgeom);
     144           0 :     fDetTypeRec->SetDefaults();
     145           0 :     fDet[0] = fDet[1] = fDet[2] = kTRUE;
     146           0 :     fEnt0 = 0;
     147             : 
     148           0 :     fEnt = Int_t(fRunLoader->GetNumberOfEvents());
     149             : 
     150           0 :     fLoader->LoadDigits("read");
     151           0 :     fLoader->LoadRecPoints("recreate");
     152           0 :     if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
     153             :  
     154           0 :     fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
     155           0 :     fDetTypeRec->MakeBranchR(fLoader->TreeR());
     156           0 :     fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
     157             : 
     158           0 :     fInit = InitRec();
     159             : 
     160           0 :     Info("Init","  Done\n\n\n");
     161             : 
     162           0 :     return fInit;
     163           0 : }
     164             : //______________________________________________________________________
     165             : Bool_t AliITSreconstruction::InitRec(){
     166             :     // Sets up Reconstruction part of AliITSDetType..
     167             :     // Inputs:
     168             :     //      none.
     169             :     // Outputs:
     170             :     //      none.
     171             :     // Return:
     172             :     //      none.
     173             : 
     174             : 
     175           0 :   fDetTypeRec->SetDefaultClusterFindersV2();
     176           0 :   Info("InitRec","    Done\n");
     177           0 :   return kTRUE;
     178             : }
     179             : //______________________________________________________________________ 
     180             : void AliITSreconstruction::Exec(const Option_t *opt){
     181             :     // Main reconstruction function.
     182             :     // Inputs:
     183             :     //      Option_t * opt   list of subdetector to digitize. =0 all.
     184             :     // Outputs:
     185             :     //      none.
     186             :     // Return:
     187             :     //      none.
     188             :     Option_t *lopt;
     189             :     Int_t evnt;
     190             :     Bool_t condition =kFALSE;
     191           0 :     if(opt){
     192           0 :       if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS"))condition =kTRUE;
     193             :     }
     194             :     else{
     195             :       condition = kTRUE;
     196             :     }
     197           0 :     if(condition){
     198           0 :       fDet[0] = fDet[1] = fDet[2] = kTRUE;
     199             :       lopt = "All";
     200           0 :     }else{
     201           0 :       fDet[0] = fDet[1] = fDet[2] = kFALSE;
     202           0 :       if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
     203           0 :       if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
     204           0 :       if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
     205           0 :       if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
     206             :       else lopt = opt;
     207             :     } // end if strstr(opt,...)
     208             : 
     209           0 :     if(!fInit){
     210           0 :       cout << "Initilization Failed, Can't run Exec." << endl;
     211           0 :       return;
     212             :     } // end if !fInit
     213           0 :     for(evnt=0;evnt<fEnt;evnt++)
     214             :      {
     215             :        //      Info("Exec","");
     216           0 :       Info("Exec","Processing Event %d",evnt);
     217             :       //      Info("Exec","");
     218             : 
     219           0 :       fRunLoader->GetEvent(evnt);
     220           0 :       if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
     221           0 :       fDetTypeRec->MakeBranchR(0);
     222           0 :       fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
     223           0 :       fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
     224           0 :       fDetTypeRec->DigitsToRecPoints(fLoader->TreeD(),fLoader->TreeR(),0,lopt);
     225             :     } // end for evnt
     226           0 : }
     227             : //______________________________________________________________________ 
     228             : void AliITSreconstruction::SetOutputFile(TString filename){
     229             :   // Set a new file name for recpoints. 
     230             :   // It must be called before Init()
     231           0 :   if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
     232           0 :   if(fLoader){
     233           0 :     Info("SetOutputFile","name for rec points is %s",filename.Data());
     234           0 :     fLoader->SetRecPointsFileName(filename);
     235           0 :   }
     236             :   else {
     237           0 :     Error("SetOutputFile",
     238           0 :     "ITS loader not available. Not possible to set name: %s",filename.Data());
     239             :   }
     240           0 : }

Generated by: LCOV version 1.11