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