]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSDigitizer.cxx
Updated version of raw data code (D.Favretto)
[u/mrichter/AliRoot.git] / ITS / AliITSDigitizer.cxx
index a9624bc0f3892a788825a1fa72fa61f357573875..aeca0f4a0105f0c13c2edbc7b8b2941fd73cfe0f 100644 (file)
  
 /*
 $Log$
+Revision 1.8  2003/03/03 17:00:30  masera
+Corrections to comply with coding conventions
+
+Revision 1.7  2002/10/25 18:54:22  barbera
+Various improvements and updates from B.S.Nilsen and T. Virgili
+
+Revision 1.6  2002/10/22 14:45:34  alibrary
+Introducing Riostream.h
+
+Revision 1.5  2002/10/14 14:57:00  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
 Revision 1.3.4.1  2002/06/10 17:51:14  hristov
 Merged with v3-08-02
 
@@ -41,23 +53,26 @@ Revision 1.2  2002/03/01  E. Lopez
 Digitization changed to start from SDigits instead of Hits.
 The SDigits are reading as TClonesArray of AliITSpListItem
 */
-
+//
+//  Class used to steer
+//  the digitization for ITS
+//
+//
 #include <stdlib.h>
-#include <iostream.h>
-#include <TObjArray.h>
+#include <Riostream.h>
+#include <TClonesArray.h> 
 #include <TTree.h>
 #include <TBranch.h>
-#include <TFile.h>
 
 #include <AliRun.h>
 #include <AliRunDigitizer.h>
 
 #include "AliITSDigitizer.h"
+#include "AliITSgeom.h"
 #include "AliITSpList.h"
-#include "AliITSmodule.h"
 #include "AliITSsimulation.h"
 #include "AliITSDetType.h"
-#include "AliITSgeom.h"
+
 
 ClassImp(AliITSDigitizer)
 
@@ -73,7 +88,7 @@ AliITSDigitizer::AliITSDigitizer() : AliDigitizer(){
     //      A blank AliITSDigitizer class.
 
     fITS      = 0;
-    fActive   = 0;
+    fModActive   = 0;
     fRoif     = -1;
     fRoiifile = 0;
     fInit     = kFALSE;
@@ -90,7 +105,7 @@ AliITSDigitizer::AliITSDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){
     //      An AliItSDigitizer class.
 
     fITS      = 0;
-    fActive   = 0;
+    fModActive   = 0;
     fRoif     = -1;
     fRoiifile = 0;
     fInit     = kFALSE;
@@ -106,7 +121,7 @@ AliITSDigitizer::~AliITSDigitizer(){
     //      none.
 
     fITS = 0; // don't delete fITS. Done else where.
-    if(fActive) delete[] fActive;
+    if(fModActive) delete[] fModActive;
 }
 //______________________________________________________________________
 Bool_t AliITSDigitizer::Init(){
@@ -122,8 +137,6 @@ Bool_t AliITSDigitizer::Init(){
     fInit = kTRUE; // Assume for now init will work.
     if(!gAlice) {
        fITS      = 0;
-       fActive   = 0;
-       fRoif     = -1;
        fRoiifile = 0;
        fInit     = kFALSE;
        Warning("Init","gAlice not found");
@@ -131,25 +144,21 @@ Bool_t AliITSDigitizer::Init(){
     } // end if
     fITS = (AliITS *)(gAlice->GetDetector("ITS"));
     if(!fITS){
-       fActive   = 0;
-       fRoif     = -1;
        fRoiifile = 0;
        fInit     = kFALSE;
        Warning("Init","ITS not found");
        return fInit;
     } else if(fITS->GetITSgeom()){
        //cout << "fRoif,fRoiifile="<<fRoif<<" "<<fRoiifile<<endl;
-       fActive = new Bool_t[fITS->GetITSgeom()->GetIndexMax()];
+       fModActive = new Bool_t[fITS->GetITSgeom()->GetIndexMax()];
     } else{
-       fActive   = 0;
-       fRoif     = -1;
        fRoiifile = 0;
        fInit     = kFALSE;
        Warning("Init","ITS geometry not found");
        return fInit;
     } // end if
-    // fActive needs to be set to a default all kTRUE value
-    for(Int_t i=0;i<fITS->GetITSgeom()->GetIndexMax();i++) fActive[i] = kTRUE;
+    // fModActive needs to be set to a default all kTRUE value
+    for(Int_t i=0;i<fITS->GetITSgeom()->GetIndexMax();i++) fModActive[i] = kTRUE;
 /*  This will not work from Init. ts is aways returned as zero.
     TTree *ts;
     if(fRoif>=0 && fRoiifile>=0 && fRoiifile<GetManager()->GetNinputs()){
@@ -214,9 +223,14 @@ void AliITSDigitizer::Exec(Option_t* opt){
     
     // Digitize
     fITS->MakeBranchInTreeD(GetManager()->GetTreeD());
+    if(fRoif!=0) Info("AliITSDigitizer","Region of Interest digitization selected");
+    else Info("AliITSDigitizer","No Region of Interest selected. Digitizing everything");
+    //cout <<"fModActive="<<fModActive<<" fRoif="<<fRoif;
+    if(fModActive==0) fRoif = 0; // fModActive array must be define for RIO cuts.
+    //cout <<" fRoif="<<fRoif<<endl;
 
     for(module=0; module<size; module++ ){
-       if(fActive && fRoif!=0) if(!fActive[module]) continue;
+       if(fRoif!=0) if(!fModActive[module]) continue;
         id = fITS->GetITSgeom()->GetModuleType(module);
         if(!all && !det[id]) continue;
         iDetType = fITS->DetType( id );
@@ -230,7 +244,7 @@ void AliITSDigitizer::Exec(Option_t* opt){
         sim->InitSimulationModule(module, event);
        //cout << "Module=" << module;
         for(ifiles=0; ifiles<nfiles; ifiles++ ){
-           if(fActive && fRoif!=0) if(!fActive[module]) continue;
+           if(fRoif!=0) if(!fModActive[module]) continue;
            //cout <<" fl[ifiles=" << ifiles << "]=" << fl[ifiles];
             TTree *treeS = GetManager()->GetInputTreeS(fl[ifiles]);
             if( !(treeS && fITS->GetSDigits()) ) continue;   
@@ -248,10 +262,10 @@ void AliITSDigitizer::Exec(Option_t* opt){
             brchSDigits->GetEvent( module );
             lmod = sim->AddSDigitsToModule(sdig,mask);
            if(ifiles==0){
-               fActive[module] = lmod;
+               fModActive[module] = lmod;
            } // end if
-           //cout << " fActive["<<module<<"]=";
-           //if(fActive[module]) cout << "kTRUE";
+           //cout << " fModActive["<<module<<"]=";
+           //if(fModActive[module]) cout << "kTRUE";
            //else cout << "kFALSE";
         } // end for ifiles
        //cout << " end ifiles loop" << endl;
@@ -269,7 +283,7 @@ void AliITSDigitizer::Exec(Option_t* opt){
     delete[] fl;
     sdig->Clear();
     delete sdig;
-    for(Int_t i=0;i<fITS->GetITSgeom()->GetIndexMax();i++) fActive[i] = kTRUE;
+    for(Int_t i=0;i<fITS->GetITSgeom()->GetIndexMax();i++) fModActive[i] = kTRUE;
     return;
 }
 //______________________________________________________________________
@@ -305,20 +319,21 @@ void AliITSDigitizer::SetByRegionOfInterest(TTree *ts){
 
     nm = fITS->GetITSgeom()->GetIndexMax();
     for(m=0;m<nm;m++){
-       //cout << " fActive["<<m<<"]=";
-       fActive[m] = kFALSE; // Not active by default
+       //cout << " fModActive["<<m<<"]=";
+       fModActive[m] = kFALSE; // Not active by default
        sdig->Clear();
        brchSDigits->GetEvent(m);
        if(sdig->GetLast()>=0) for(i=0;i<sdig->GetLast();i++){
            // activate the necessary modules
            if(((AliITSpList*)sdig->At(m))->GetpListItem(i)->GetSignal()>0.0){ // Must have non zero signal.
-               fActive[m] = kTRUE;
+               fModActive[m] = kTRUE;
                break;
            } // end if
        } // end if. end for i.
-       //cout << fActive[m];
+       //cout << fModActive[m];
        //cout << endl;
     } // end for m
+    Info("AliITSDigitizer","Digitization by Region of Interest selected");
     sdig->Clear();
     delete sdig;
     return;