]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHDigitizer.cxx
05d8448c28334257aeb0593e49221f1d4cce878b
[u/mrichter/AliRoot.git] / RICH / AliRICHDigitizer.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2000, 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
17 #include <Riostream.h> 
18
19 #include <TTree.h> 
20 #include <TObjArray.h>
21 #include <TFile.h>
22 #include <TDirectory.h>
23 #include <TParticle.h>
24
25 #include <AliRunLoader.h>
26 #include <AliLoader.h>
27
28 #include "AliRICHDigitizer.h"
29 #include "AliRICH.h"
30 #include "AliRunDigitizer.h"
31
32 ClassImp(AliRICHDigitizer)
33
34 //__________________________________________________________________________________________________
35 AliRICHDigitizer::AliRICHDigitizer() 
36 {//default constructor
37 }//default ctor
38 //__________________________________________________________________________________________________
39 AliRICHDigitizer::AliRICHDigitizer(AliRunDigitizer *pManager) 
40                  :AliDigitizer(pManager)
41 {
42 //main ctor which should be used
43   Info("main ctor","Start.");
44   fRich=(AliRICH*)gAlice->GetDetector("RICH");
45   Rich()->Param()->GenSigmaThMap();
46 }//main ctor
47 //__________________________________________________________________________________________________
48 AliRICHDigitizer::~AliRICHDigitizer()
49 {
50 //dtor
51   Info("dtor","Start.");
52 }//dtor
53 //__________________________________________________________________________________________________
54 void AliRICHDigitizer::Exec(Option_t*)
55 {
56   Info("Exec","\n\n\n\n");
57   Info("Exec","Start with %i input(s) for event %i",fManager->GetNinputs(),fManager->GetOutputEventNr());
58   
59   AliRunLoader *pInAL=0, *pOutAL;//in and out Run loaders
60   AliLoader    *pInRL=0, *pOutRL;//in and out RICH loaders
61  
62   pOutAL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
63   pOutRL = pOutAL->GetLoader("RICHLoader");
64   pOutRL->MakeTree("D");   Rich()->MakeBranch("D"); //create TreeD with RICH branches in output stream
65
66   for(Int_t inFileN=0;inFileN<fManager->GetNinputs();inFileN++){//files loop
67     pInAL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inFileN)); pInRL = pInAL->GetLoader("RICHLoader");
68     pInAL->GetEvent(fManager->GetOutputEventNr());    pInRL->LoadSDigits();    pInRL->TreeS()->GetEntry(0);
69     Info("Exec","Run Loader %p RICH Loader %p RICH %p",pInAL,pInRL,Rich());
70     Rich()->SDigits()->Print();
71     pInRL->UnloadSDigits();
72   }//files loop
73   
74 //     Rich()->SDigits()->Sort();                     //sort them according to Id() methode
75 //       
76 //     Int_t combiPid=0,chamber=0,x=0,y=0,tid[3],id=0; Double_t q=0;
77 //     Int_t iNdigitsPerPad=0;//how many sdigits for a given pad
78 //     for(Int_t i=0;i<Rich()->SDigits()->GetEntries();i++){//sdigits loop (sorted)
79 //       AliRICHdigit *pSdig=(AliRICHdigit*)Rich()->SDigits()->At(i);
80 //       if(pSdig->Id()==id){//still the same pad
81 //         iNdigitsPerPad++;
82 //         q+=pSdig->Q();
83 //         combiPid+=pSdig->CombiPid();
84 //         if(iNdigitsPerPad<=3)
85 //           tid[iNdigitsPerPad-1]=pSdig->Tid(0);
86 //         else
87 //           Warning("SDigits2Digits","More then 3 sdigits for the given pad");
88 //       }else{//new pad, add the pevious one
89 //         if(id!=kBad&&Rich()->Param()->IsOverTh(chamber,x,y,q)) {
90 //            Rich()->AddDigit(chamber,x,y,(Int_t)q,combiPid,tid); //add newly created digit to the list of digits
91 //          }
92 //         combiPid=pSdig->CombiPid();chamber=pSdig->C();id=pSdig->Id();
93 //         x=pSdig->X();y=pSdig->Y();
94 //         q=pSdig->Q();
95 //         tid[0]=pSdig->Tid(0);
96 //         iNdigitsPerPad=1;tid[1]=tid[2]=kBad;
97 //       }
98 //     }//sdigits loop (sorted)
99 //   
100 //     if(Rich()->SDigits()->GetEntries()&&Rich()->Param()->IsOverTh(chamber,x,y,q))
101 //       Rich()->AddDigit(chamber,x,y,(Int_t)q,combiPid,tid);//add the last digit
102 //         
103   pOutRL->TreeD()->Fill();              //fill the tree with the list of digits
104   pOutRL->WriteDigits("OVERWRITE");     //serialize them to file
105             
106   Info("Exec","Stop\n\n\n\n");
107 }//Exec()
108 //__________________________________________________________________________________________________