]>
Commit | Line | Data |
---|---|---|
30178c30 | 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$ */ | |
d1775029 | 17 | |
18 | // Do the Digitization (Digit) from summable Digits (SDigit) | |
19 | // Allow the merging of signal file with background file(s). | |
20 | ||
cf286af7 | 21 | ///////////////////////////////////////////////////////////////////////////////// |
22 | // | |
23 | // AliMUONDigitizerv2 digitizes digits from s-digits. | |
24 | // Merging is allowed from multiple input streams. The first input stream is | |
25 | // assumed to be the signal and all other input streams as assumed to be | |
26 | // background. | |
27 | // Chamber response is applied to the digits identically to AliMUONDigitizerv1. | |
28 | // | |
29 | ///////////////////////////////////////////////////////////////////////////////// | |
30 | ||
30178c30 | 31 | #include "AliMUONData.h" |
32 | #include "AliMUONLoader.h" | |
33 | #include "AliMUONConstants.h" | |
34 | #include "AliMUONDigit.h" | |
35 | #include "AliMUONDigitizerv2.h" | |
36 | #include "AliMUONTransientDigit.h" | |
8c343c7c | 37 | #include "AliLog.h" |
30178c30 | 38 | |
d1775029 | 39 | ClassImp(AliMUONDigitizerv2) |
40 | ||
41 | //___________________________________________ | |
cf286af7 | 42 | AliMUONDigitizerv2::AliMUONDigitizerv2() : AliMUONDigitizerv1() |
d1775029 | 43 | { |
cf286af7 | 44 | // Default ctor - don't use it |
d1775029 | 45 | } |
46 | ||
47 | //___________________________________________ | |
cf286af7 | 48 | AliMUONDigitizerv2::AliMUONDigitizerv2(AliRunDigitizer* manager) : AliMUONDigitizerv1(manager) |
d1775029 | 49 | { |
cf286af7 | 50 | // ctor which should be used |
d1775029 | 51 | } |
52 | ||
8789635b | 53 | //___________________________________________ |
54 | AliMUONDigitizerv2::~AliMUONDigitizerv2() | |
55 | { | |
56 | // Destructor | |
57 | } | |
58 | ||
cf286af7 | 59 | //----------------------------------------------------------------------- |
60 | void AliMUONDigitizerv2::GenerateTransientDigits() | |
d1775029 | 61 | { |
cf286af7 | 62 | // Loop over all chambers and s-digits in the input stream and create |
63 | // AliMUONTransientDigit objects from them. These are then added to fTDList. | |
d1775029 | 64 | |
8c343c7c | 65 | AliDebug(2,"Generating transient digits using treeH = 0x%X"); |
cf286af7 | 66 | // |
67 | // Loop over SDigits | |
68 | Int_t ndig, k; | |
69 | AliMUONDigit* sDigit; | |
70 | TClonesArray* muonSDigits; | |
71 | for (Int_t ich = 0; ich < AliMUONConstants::NCh(); ich++) // loop over chamber | |
72 | { | |
30178c30 | 73 | fMUONData->ResetSDigits(); |
74 | fMUONData->GetCathodeS(0); | |
75 | muonSDigits = fMUONData->SDigits(ich); | |
cf286af7 | 76 | ndig = muonSDigits->GetEntriesFast(); |
77 | for (k = 0; k < ndig; k++) | |
78 | { | |
79 | sDigit = (AliMUONDigit*) muonSDigits->UncheckedAt(k); | |
80 | MakeTransientDigitFromSDigit(ich,sDigit); | |
81 | } | |
30178c30 | 82 | fMUONData->ResetSDigits(); |
83 | fMUONData->GetCathodeS(1); | |
84 | muonSDigits = fMUONData->SDigits(ich); | |
cf286af7 | 85 | ndig=muonSDigits->GetEntriesFast(); |
86 | for (k = 0; k < ndig; k++) | |
87 | { | |
88 | sDigit = (AliMUONDigit*) muonSDigits->UncheckedAt(k); | |
89 | MakeTransientDigitFromSDigit(ich,sDigit); | |
925e6570 | 90 | } |
cf286af7 | 91 | } // SDigits loop, end loop over chamber |
925e6570 | 92 | } |
d1775029 | 93 | |
94 | //------------------------------------------------------------------------ | |
cf286af7 | 95 | void AliMUONDigitizerv2::MakeTransientDigitFromSDigit(Int_t iChamber, AliMUONDigit* sDigit) |
d1775029 | 96 | { |
cf286af7 | 97 | // Makes a transient digit from the specified s-digit from the specified chamber. |
98 | // Once the digit is created it is added to the fTDList. | |
d1775029 | 99 | |
8c343c7c | 100 | AliDebug(4,Form("Making transient digit from s-digit for chamber %d.", iChamber)); |
a713db22 | 101 | Int_t digits[7]; |
cf286af7 | 102 | // |
103 | // Creating a new TransientDigits from SDigit | |
104 | digits[0] = sDigit->PadX(); // Padx of the Digit | |
105 | digits[1] = sDigit->PadY(); // Pady of the Digit | |
106 | digits[2] = sDigit->Cathode()+1; // Cathode plane | |
107 | digits[3] = sDigit->Signal(); // Induced charge in the Pad | |
108 | if (fSignal) | |
109 | digits[4] = sDigit->Signal(); | |
110 | else | |
111 | digits[4] = 0; | |
112 | ||
113 | digits[5] = sDigit->Hit(); // Hit number in the list | |
a713db22 | 114 | if (GetSegmentation() == 1) |
115 | digits[6] = 0; | |
116 | else | |
117 | digits[6] = sDigit->DetElemId(); | |
118 | ||
119 | AliDebug(5,Form("Made digit from sDigit 0x%X: PadX %d\tPadY %d\tPlane %d\tCharge %d\tHit %d\tidDE %d", | |
120 | (void*)sDigit, digits[0], digits[1], digits[2], digits[3], digits[5], digits[6])); | |
cf286af7 | 121 | |
cf286af7 | 122 | |
123 | AliMUONTransientDigit* mTD = new AliMUONTransientDigit(iChamber, digits); | |
124 | // Copy list of tracks and trackcharge | |
125 | for(Int_t itrack = 0; itrack < kMAXTRACKS; itrack++) | |
126 | { | |
127 | Int_t track = sDigit->Track(itrack); | |
128 | if (track < 0) break; // Check if we reached the end of the track list. | |
129 | mTD->AddToTrackList( track + fMask, sDigit->TrackCharge(itrack) ); | |
925e6570 | 130 | } |
cf286af7 | 131 | |
132 | OnCreateTransientDigit(mTD, sDigit); | |
133 | AddOrUpdateTransientDigit(mTD); | |
925e6570 | 134 | } |
d1775029 | 135 | |
136 | //------------------------------------------------------------------------ | |
a713db22 | 137 | void AliMUONDigitizerv2::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[7]) |
d1775029 | 138 | { |
cf286af7 | 139 | // Override to add new digits to the digits tree TreeD. |
30178c30 | 140 | fMUONData->AddDigit(chamber, tracks, charges, digits); |
925e6570 | 141 | } |
d1775029 | 142 | |
cf286af7 | 143 | //------------------------------------------------------------------------ |
144 | Bool_t AliMUONDigitizerv2::InitInputData(AliMUONLoader* muonloader) | |
d1775029 | 145 | { |
30178c30 | 146 | // Overridden to initialize fMUONData to read from the s-digits tree TreeS. |
cf286af7 | 147 | // If the s-digits are not loaded then the muon loader is used to load the |
148 | // s-digits into memory. | |
d1775029 | 149 | |
8c343c7c | 150 | AliDebug(3,"Loading s-digits in READ mode and setting the tree address."); |
30178c30 | 151 | fMUONData->SetLoader(muonloader); |
d1775029 | 152 | |
cf286af7 | 153 | if (muonloader->TreeS() == NULL) |
154 | { | |
155 | muonloader->LoadSDigits("READ"); | |
156 | if (muonloader->TreeS() == NULL) | |
157 | { | |
8c343c7c | 158 | AliError("Can not load the s-digits tree."); |
cf286af7 | 159 | return kFALSE; |
925e6570 | 160 | } |
161 | } | |
be42eafc | 162 | |
30178c30 | 163 | fMUONData->SetTreeAddress("S"); |
cf286af7 | 164 | return kTRUE; |
925e6570 | 165 | } |
cf286af7 | 166 | |
d1775029 | 167 | //------------------------------------------------------------------------ |
cf286af7 | 168 | void AliMUONDigitizerv2::CleanupInputData(AliMUONLoader* muonloader) |
d1775029 | 169 | { |
cf286af7 | 170 | // Overridden to release and unload s-digits from memory. |
171 | ||
8c343c7c | 172 | AliDebug(3,"Releasing loaded s-digits."); |
30178c30 | 173 | fMUONData->ResetSDigits(); |
cf286af7 | 174 | muonloader->UnloadSDigits(); |
925e6570 | 175 | } |