]>
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$ */ | |
cf286af7 | 17 | |
18 | ///////////////////////////////////////////////////////////////////////////////// | |
19 | // | |
20 | // AliMUONDigitizerv1 implements a full digitizer to digitize digits directly | |
21 | // from hits. It also performs merging over several input streams. | |
22 | // The first input stream is assumed to be the signal and all other input | |
23 | // streams are assumed to be background. SDigits are never generated by this | |
24 | // digitizer and one should use the AliMUONSDigitizerv1 for that task. | |
25 | // | |
26 | // NOTE: This digitizer will become depricated in the future in favour of | |
27 | // AliMUONSDigitizerv1 and AliMUONDigitizerv2. | |
28 | // | |
29 | ///////////////////////////////////////////////////////////////////////////////// | |
8dbbc4e3 | 30 | |
30178c30 | 31 | #include <TTree.h> |
32 | ||
33 | #include "AliMUON.h" | |
34 | #include "AliMUONData.h" | |
35 | #include "AliMUONLoader.h" | |
36 | #include "AliMUONChamber.h" | |
37 | #include "AliMUONConstants.h" | |
38 | #include "AliMUONDigitizerv1.h" | |
39 | #include "AliMUONHit.h" | |
40 | #include "AliMUONTransientDigit.h" | |
ce3e25a8 | 41 | #include "AliMUONTriggerDecision.h" |
8c343c7c | 42 | #include "AliLog.h" |
30178c30 | 43 | |
8dbbc4e3 | 44 | ClassImp(AliMUONDigitizerv1) |
45 | ||
46 | //___________________________________________ | |
cf286af7 | 47 | AliMUONDigitizerv1::AliMUONDigitizerv1() : AliMUONDigitizer() |
8dbbc4e3 | 48 | { |
cf286af7 | 49 | // Default ctor - don't use it |
8dbbc4e3 | 50 | } |
51 | ||
52 | //___________________________________________ | |
cf286af7 | 53 | AliMUONDigitizerv1::AliMUONDigitizerv1(AliRunDigitizer* manager) : AliMUONDigitizer(manager) |
8dbbc4e3 | 54 | { |
cf286af7 | 55 | // ctor which should be used |
ce3e25a8 | 56 | |
8dbbc4e3 | 57 | } |
58 | ||
8789635b | 59 | //___________________________________________ |
60 | AliMUONDigitizerv1::~AliMUONDigitizerv1() | |
61 | { | |
ce3e25a8 | 62 | // dtor |
63 | } | |
64 | //----------------------------------------------------------------------- | |
65 | ||
66 | void AliMUONDigitizerv1::CleanupTriggerArrays() | |
67 | { | |
68 | fTrigDec->ClearDigits(); | |
8789635b | 69 | } |
70 | ||
cf286af7 | 71 | //----------------------------------------------------------------------- |
72 | void AliMUONDigitizerv1::GenerateTransientDigits() | |
73 | { | |
74 | // Loops over all tracks and hits in the current selected event and calls | |
75 | // MakeTransientDigitsFromHit for each hit. | |
76 | // Note: Charge correlation is applied to the tracking chambers. | |
77 | ||
30178c30 | 78 | TTree* treeH = fGime->TreeH(); |
8c343c7c | 79 | AliDebug(2, Form("Generating transient digits using treeH = 0x%X" |
80 | , (void*)treeH)); | |
cf286af7 | 81 | // |
82 | // Loop over tracks | |
83 | Int_t ntracks = (Int_t) treeH->GetEntries(); | |
84 | for (Int_t itrack = 0; itrack < ntracks; itrack++) | |
85 | { | |
8c343c7c | 86 | AliDebug(3, Form("Processing track %d...", itrack)); |
30178c30 | 87 | fMUONData->ResetHits(); |
cf286af7 | 88 | treeH->GetEvent(itrack); |
89 | // | |
90 | // Loop over hits | |
30178c30 | 91 | TClonesArray* hits = fMUONData->Hits(); |
cf286af7 | 92 | for (Int_t ihit = 0; ihit < hits->GetEntriesFast(); ihit++) |
93 | { | |
94 | AliMUONHit* mHit = static_cast<AliMUONHit*>( hits->At(ihit) ); | |
95 | Int_t ichamber = mHit->Chamber()-1; // chamber number | |
96 | if (ichamber > AliMUONConstants::NCh()-1) | |
97 | { | |
8c343c7c | 98 | AliError(Form("Hit 0x%X has a invalid chamber number: %d", ichamber)); |
cf286af7 | 99 | continue; |
100 | } | |
101 | // | |
102 | //Dumping Hit content: | |
8c343c7c | 103 | AliDebug(3,Form("Hit %d: chamber = %d\tX = %f\tY = %f\tZ = %f\teloss = %f", |
cf286af7 | 104 | ihit, mHit->Chamber(), mHit->X(), mHit->Y(), mHit->Z(), mHit->Eloss() |
8c343c7c | 105 | )); |
cf286af7 | 106 | // |
107 | // Inititializing Correlation | |
30178c30 | 108 | AliMUONChamber& chamber = fMUON->Chamber(ichamber); |
cf286af7 | 109 | chamber.ChargeCorrelationInit(); |
110 | if (ichamber < AliMUONConstants::NTrackingCh()) | |
111 | { | |
112 | // Tracking Chamber | |
113 | // Initialize hit position (cursor) in the segmentation model | |
114 | chamber.SigGenInit(mHit->X(), mHit->Y(), mHit->Z()); | |
925e6570 | 115 | } // else do nothing for Trigger Chambers |
cf286af7 | 116 | |
117 | MakeTransientDigitsFromHit(itrack, ihit, mHit); | |
118 | } // hit loop | |
119 | } // track loop | |
925e6570 | 120 | } |
cf286af7 | 121 | |
122 | //-------------------------------------------------------------------------- | |
123 | void AliMUONDigitizerv1::MakeTransientDigitsFromHit(Int_t track, Int_t iHit, AliMUONHit * mHit) | |
124 | { | |
125 | // This method is called for every hit in an event to generate AliMUONTransientDigits | |
126 | // from the hit and add these to fTDList. | |
127 | // The AliMUONChamber::DisIntegration method us used to figure out which pads are | |
128 | // fired for a given hit. We then loop over the fired pads and add an AliMUONTransientDigit | |
129 | // for each pad. | |
130 | ||
8c343c7c | 131 | AliDebug(4,Form("Making transient digit for hit number %d.", iHit)); |
cf286af7 | 132 | |
133 | // | |
134 | // Calls the charge disintegration method of the current chamber | |
8c343c7c | 135 | AliDebug(5,"Calling AliMUONChamber::DisIngtegration..."); |
cf286af7 | 136 | |
137 | Float_t newdigit[6][500]; // Pad information | |
138 | Int_t nnew=0; // Number of touched Pads per hit | |
139 | Int_t ichamber = mHit->Chamber()-1; | |
30178c30 | 140 | AliMUONChamber& chamber = fMUON->Chamber(ichamber); |
cf286af7 | 141 | chamber.DisIntegration(mHit->Eloss(), mHit->Age(), mHit->X(), mHit->Y(), mHit->Z(), nnew, newdigit); |
142 | ||
143 | // Creating new TransientDigits from hit | |
144 | for(Int_t iTD = 0; iTD < nnew; iTD++) | |
145 | { | |
146 | Int_t charge; | |
147 | Int_t digits[6]; | |
148 | ||
149 | digits[0] = Int_t(newdigit[1][iTD]); // Padx of the Digit | |
150 | digits[1] = Int_t(newdigit[2][iTD]); // Pady of the Digit | |
151 | digits[2] = Int_t(newdigit[5][iTD]); // Cathode plane | |
152 | digits[3] = Int_t(newdigit[3][iTD]); // Induced charge in the Pad | |
153 | if (fSignal) | |
154 | { | |
155 | charge = digits[3]; | |
156 | digits[4] = Int_t(newdigit[3][iTD]); // Signal due to physics | |
157 | } | |
158 | else | |
159 | { | |
160 | charge = digits[3] + fMask; | |
161 | digits[4] = 0; // No signal due to physics since this is now background. | |
925e6570 | 162 | } |
cf286af7 | 163 | digits[5] = iHit+fMask; // Hit number in the list |
164 | ||
8c343c7c | 165 | AliDebug(5,Form("MakeTransientDigitsFromHit", |
cf286af7 | 166 | "DisIntegration result %d: PadX %d\tPadY %d\tPlane %d\tCharge %d\tHit %d", |
8c343c7c | 167 | iTD, digits[0], digits[1], digits[2], digits[3], digits[5])); |
cf286af7 | 168 | |
169 | AliMUONTransientDigit* mTD = new AliMUONTransientDigit(ichamber, digits); | |
170 | mTD->AddToTrackList(track + fMask, charge); | |
171 | ||
172 | OnCreateTransientDigit(mTD, mHit); | |
173 | AddOrUpdateTransientDigit(mTD); | |
925e6570 | 174 | } |
175 | } | |
cf286af7 | 176 | |
8dbbc4e3 | 177 | //------------------------------------------------------------------------ |
cf286af7 | 178 | void AliMUONDigitizerv1::AddDigit(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[6]) |
8dbbc4e3 | 179 | { |
cf286af7 | 180 | // Derived to add digits to TreeD. |
ce3e25a8 | 181 | fMUONData->AddDigit(chamber, tracks, charges, digits); |
925e6570 | 182 | } |
ce3e25a8 | 183 | |
184 | //------------------------------------------------------------------------ | |
185 | void AliMUONDigitizerv1::AddDigitTrigger(Int_t chamber, Int_t tracks[kMAXTRACKS], Int_t charges[kMAXTRACKS], Int_t digits[6]) | |
186 | { | |
187 | // Derived to add digits to TreeD for trigger. | |
188 | fTrigDec->AddDigit(chamber, tracks, charges, digits); | |
925e6570 | 189 | } |
ce3e25a8 | 190 | |
191 | //------------------------------------------------------------------------ | |
192 | void AliMUONDigitizerv1::FillTriggerOutput() | |
193 | { | |
194 | // Derived to fill TreeD and resets the trigger array in fMUONData. | |
195 | ||
8c343c7c | 196 | AliDebug(3,"Filling trees with trigger."); |
ce3e25a8 | 197 | fMUONData->Fill("GLT"); |
198 | fMUONData->ResetTrigger(); | |
925e6570 | 199 | } |
ce3e25a8 | 200 | |
201 | //------------------------------------------------------------------------ | |
202 | void AliMUONDigitizerv1::CreateTrigger() | |
203 | { | |
204 | fMUONData->MakeBranch("GLT"); | |
205 | fMUONData->SetTreeAddress("GLT"); | |
206 | fTrigDec->Digits2Trigger(); | |
207 | FillTriggerOutput(); | |
208 | ||
925e6570 | 209 | } |
8dbbc4e3 | 210 | |
211 | //------------------------------------------------------------------------ | |
cf286af7 | 212 | Int_t AliMUONDigitizerv1::GetSignalFrom(AliMUONTransientDigit* td) |
8dbbc4e3 | 213 | { |
cf286af7 | 214 | // Derived to apply the chamber response model to the digit. |
215 | // Using AliMUONChamber::ResponseModel() for this. | |
216 | ||
8c343c7c | 217 | AliDebug(4, "Applying response of chamber to TransientDigit signal."); |
cf286af7 | 218 | // |
219 | // Digit Response (noise, threshold, saturation, ...) | |
220 | Int_t q = td->Signal(); | |
30178c30 | 221 | AliMUONChamber& chamber = fMUON->Chamber(td->Chamber()); |
cf286af7 | 222 | AliMUONResponse* response = chamber.ResponseModel(); |
223 | q = response->DigitResponse(q, td); | |
224 | return q; | |
925e6570 | 225 | } |
8dbbc4e3 | 226 | |
227 | //------------------------------------------------------------------------ | |
cf286af7 | 228 | Bool_t AliMUONDigitizerv1::InitOutputData(AliMUONLoader* muonloader) |
8dbbc4e3 | 229 | { |
cf286af7 | 230 | // Derived to initialize the output digits tree TreeD, create it if necessary |
30178c30 | 231 | // and sets the fMUONData tree address to treeD. |
cf286af7 | 232 | |
8c343c7c | 233 | AliDebug(3, "Creating digits branch and setting the tree address."); |
cf286af7 | 234 | |
30178c30 | 235 | fMUONData->SetLoader(muonloader); |
cf286af7 | 236 | |
237 | // New branch per chamber for MUON digit in the tree of digits | |
238 | if (muonloader->TreeD() == NULL) | |
239 | { | |
240 | muonloader->MakeDigitsContainer(); | |
241 | if (muonloader->TreeD() == NULL) | |
242 | { | |
8c343c7c | 243 | AliError("Could not create TreeD."); |
cf286af7 | 244 | return kFALSE; |
925e6570 | 245 | } |
246 | } | |
cf286af7 | 247 | |
30178c30 | 248 | fMUONData->MakeBranch("D"); |
249 | fMUONData->SetTreeAddress("D"); | |
cf286af7 | 250 | |
251 | return kTRUE; | |
925e6570 | 252 | } |
8dbbc4e3 | 253 | |
254 | //------------------------------------------------------------------------ | |
cf286af7 | 255 | void AliMUONDigitizerv1::FillOutputData() |
8dbbc4e3 | 256 | { |
30178c30 | 257 | // Derived to fill TreeD and resets the digit array in fMUONData. |
1391e633 | 258 | |
8c343c7c | 259 | AliDebug(3, "Filling trees with digits."); |
30178c30 | 260 | fMUONData->Fill("D"); |
261 | fMUONData->ResetDigits(); | |
925e6570 | 262 | } |
8dbbc4e3 | 263 | |
264 | //------------------------------------------------------------------------ | |
cf286af7 | 265 | void AliMUONDigitizerv1::CleanupOutputData(AliMUONLoader* muonloader) |
8dbbc4e3 | 266 | { |
cf286af7 | 267 | // Derived to write the digits tree and then unload the digits tree once written. |
8dbbc4e3 | 268 | |
8c343c7c | 269 | AliDebug(3, "Writing digits and releasing pointers."); |
cf286af7 | 270 | muonloader->WriteDigits("OVERWRITE"); |
271 | muonloader->UnloadDigits(); | |
925e6570 | 272 | } |
8dbbc4e3 | 273 | |
cf286af7 | 274 | |
275 | //------------------------------------------------------------------------ | |
276 | Bool_t AliMUONDigitizerv1::InitInputData(AliMUONLoader* muonloader) | |
8dbbc4e3 | 277 | { |
cf286af7 | 278 | // Derived to initialise the input to read from TreeH the hits tree. |
279 | // If the hits are not loaded then we load the hits using the muon loader. | |
280 | ||
8c343c7c | 281 | AliDebug(3, "Loading hits in READ mode and setting the tree address."); |
cf286af7 | 282 | |
30178c30 | 283 | fMUONData->SetLoader(muonloader); |
cf286af7 | 284 | |
285 | if (muonloader->TreeH() == NULL) | |
286 | { | |
287 | muonloader->LoadHits("READ"); | |
288 | if (muonloader->TreeH() == NULL) | |
289 | { | |
8c343c7c | 290 | AliError("Can not load the hits tree."); |
cf286af7 | 291 | return kFALSE; |
925e6570 | 292 | } |
293 | } | |
cf286af7 | 294 | |
30178c30 | 295 | fMUONData->SetTreeAddress("H"); |
cf286af7 | 296 | return kTRUE; |
925e6570 | 297 | } |
cf286af7 | 298 | |
8dbbc4e3 | 299 | //------------------------------------------------------------------------ |
cf286af7 | 300 | void AliMUONDigitizerv1::CleanupInputData(AliMUONLoader* muonloader) |
8dbbc4e3 | 301 | { |
cf286af7 | 302 | // Derived to release the loaded hits and unload them. |
303 | ||
8c343c7c | 304 | AliDebug(3, "Releasing loaded hits."); |
30178c30 | 305 | fMUONData->ResetHits(); |
cf286af7 | 306 | muonloader->UnloadHits(); |
925e6570 | 307 | } |
cf286af7 | 308 |