]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONSDigitizerv1.cxx
Added virtual destructor (I. Hrivnacova)
[u/mrichter/AliRoot.git] / MUON / AliMUONSDigitizerv1.cxx
1
2 #include <Riostream.h>
3 #include <TDirectory.h>
4 #include <TFile.h>
5 #include <TObjArray.h>
6 #include <TPDGCode.h>
7 #include <TTree.h> 
8 #include <TMath.h>
9
10 #include "AliRun.h"
11 #include "AliRunLoader.h"
12 #include "AliLoader.h"
13
14 #include "AliMUON.h"
15 #include "AliMUONChamber.h"
16 #include "AliMUONConstants.h"
17 #include "AliMUONDigit.h"
18 #include "AliMUONSDigitizerv1.h"
19 #include "AliMUONHit.h"
20 #include "AliMUONHitMapA1.h"
21 #include "AliMUONPadHit.h"
22 #include "AliMUONTransientDigit.h"
23
24 /////////////////////////////////////////////////////////////////////////////////
25 //
26 // AliMUONSDigitizerv1 digitizes hits from the input stream into s-digits. 
27 // The s-digits are written to the s-digit tree TreeS.
28 // The same algorithm is implemented as for AliMUONDigitizerv1 however the
29 // chamber response is not applied to the s-digits and we write to TreeS and 
30 // not TreeD.
31 //
32 /////////////////////////////////////////////////////////////////////////////////
33
34 ClassImp(AliMUONSDigitizerv1)
35
36 //___________________________________________
37 AliMUONSDigitizerv1::AliMUONSDigitizerv1() : AliMUONDigitizerv1()
38 {
39         // Default ctor - don't use it
40 }
41
42 //___________________________________________
43 AliMUONSDigitizerv1::AliMUONSDigitizerv1(AliRunDigitizer* manager) : AliMUONDigitizerv1(manager)
44 {
45         // ctor which should be used
46 }
47
48 //___________________________________________
49 AliMUONSDigitizerv1::~AliMUONSDigitizerv1()
50 {
51         // Destructor
52 }
53
54 //------------------------------------------------------------------------
55 void AliMUONSDigitizerv1::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[6])
56 {
57 // Derived to write to the s-digit tree TreeS.
58
59         muondata->AddSDigit(chamber, tracks, charges, digits);   
60 };
61
62 //------------------------------------------------------------------------
63 Int_t AliMUONSDigitizerv1::GetSignalFrom(AliMUONTransientDigit* td)
64 {
65 // Returns the transient digit signal as is without applying the chamber response.
66
67         if (GetDebug() > 3) Info("GetSignalFrom", "Returning TransientDigit signal.");
68         return td->Signal(); 
69 };
70
71 //------------------------------------------------------------------------
72 Bool_t AliMUONSDigitizerv1::InitOutputData(AliMUONLoader* muonloader)
73 {
74 // Overridden to initialise the output tree to be TreeS rather than TreeD.
75
76         if (GetDebug() > 2)
77                 Info("InitOutputData", "Creating s-digits branch and setting the tree address.");
78
79         muondata->SetLoader(muonloader);
80
81         // New branch per chamber for MUON digit in the tree of digits
82         if (muonloader->TreeS() == NULL)
83         {
84                 muonloader->MakeSDigitsContainer();
85                 if (muonloader->TreeS() == NULL)
86                 {
87                         Error("InitOutputData", "Could not create TreeS.");
88                         return kFALSE;
89                 };
90         };
91
92         muondata->MakeBranch("S");
93         muondata->SetTreeAddress("S");
94         
95         return kTRUE;
96 };
97
98 //------------------------------------------------------------------------
99 void AliMUONSDigitizerv1::FillOutputData()
100 {
101 // Overridden to fill TreeS rather than TreeD.
102
103         if (GetDebug() > 2) Info("FillOutputData", "Filling trees with s-digits.");
104         muondata->Fill("S");
105         muondata->ResetSDigits();
106 };
107
108 //------------------------------------------------------------------------
109 void AliMUONSDigitizerv1::CleanupOutputData(AliMUONLoader* muonloader)
110 {
111 // Overridden to write and then cleanup TreeS that was initialised in InitOutputData.
112
113         if (GetDebug() > 2) Info("CleanupOutputData", "Writing s-digits and releasing pointers.");
114         muonloader->WriteSDigits("OVERWRITE");
115         muondata->ResetSDigits();
116         muonloader->UnloadSDigits();
117 };