]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | **************************************************************************/ | |
4c039060 | 15 | |
88cb7938 | 16 | /* $Id$ */ |
17 | ||
d19b6003 | 18 | // ------------------ |
19 | // Class AliMUON | |
20 | // ------------------ | |
21 | // AliDetector class for MUON subsystem | |
22 | // providing simulation data management | |
fe4da5cc | 23 | |
88cb7938 | 24 | #include "Riostream.h" |
25 | ||
26 | #include <AliPDG.h> | |
a897a37a | 27 | #include <TBRIK.h> |
88cb7938 | 28 | #include <TCanvas.h> |
29 | #include <TDirectory.h> | |
30 | #include <TFile.h> | |
94de3818 | 31 | #include <TGeometry.h> |
88cb7938 | 32 | #include <TMinuit.h> |
fe4da5cc | 33 | #include <TNode.h> |
88cb7938 | 34 | #include <TNtuple.h> |
fe4da5cc | 35 | #include <TObjArray.h> |
88cb7938 | 36 | #include <TObject.h> |
37 | #include <TObjectTable.h> | |
38 | #include <TPad.h> | |
a897a37a | 39 | #include <TParticle.h> |
40 | #include <TROOT.h> | |
88cb7938 | 41 | #include <TRandom.h> |
42 | #include <TRotMatrix.h> | |
43 | #include <TTUBE.h> | |
a9e2aefa | 44 | #include <TTUBE.h> |
88cb7938 | 45 | #include <TTree.h> |
46 | #include <TVector.h> | |
47 | #include <TVirtualMC.h> | |
fe4da5cc | 48 | |
d4bb94a1 | 49 | //#include "AliHeader.h" |
88cb7938 | 50 | #include "AliLoader.h" |
dbb4e169 | 51 | #include "AliRunDigitizer.h" |
307d9d04 | 52 | #include "AliMC.h" |
fac3a970 | 53 | #include "AliRun.h" |
fe4da5cc | 54 | #include "AliMUON.h" |
88cb7938 | 55 | #include "AliMUONChamberTrigger.h" |
88cb7938 | 56 | #include "AliMUONConstants.h" |
ffd9faa2 | 57 | #include "AliMUONHit.h" |
a9e2aefa | 58 | #include "AliMUONRawCluster.h" |
88cb7938 | 59 | #include "AliMUONTransientDigit.h" |
ecfa008b | 60 | #include "AliMUONTriggerCircuit.h" |
504d0837 | 61 | #include "AliMUONGeometry.h" |
62 | #include "AliMUONGeometryTransformer.h" | |
d4bb94a1 | 63 | #include "AliMUONGeometryBuilder.h" |
e118b27e | 64 | #include "AliMUONCommonGeometryBuilder.h" |
d1cd2474 | 65 | #include "AliMUONVGeometryBuilder.h" |
a713db22 | 66 | #include "AliMUONGeometrySegmentation.h" |
dbb4e169 | 67 | #include "AliMUONDigitizerv2.h" |
d1775029 | 68 | #include "AliMUONSDigitizerv1.h" |
a19e2543 | 69 | #include "AliMUONRawWriter.h" |
504d0837 | 70 | #include "AliMUONSegmentation.h" |
8c343c7c | 71 | #include "AliLog.h" |
a9e2aefa | 72 | |
68585390 | 73 | #include "AliMUONSDigitizerV2.h" |
74 | #include "AliMUONDigitizerV3.h" | |
75 | ||
d5609cfc | 76 | #include "AliMUONSt1GeometryBuilderV2.h" |
77 | #include "AliMUONSt2GeometryBuilderV2.h" | |
78 | #include "AliMUONSlatGeometryBuilder.h" | |
79 | #include "AliMUONTriggerGeometryBuilder.h" | |
80 | ||
a9e2aefa | 81 | // Defaults parameters for Z positions of chambers |
82 | // taken from values for "stations" in AliMUON::AliMUON | |
83 | // const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.}; | |
84 | // and from array "dstation" in AliMUONv1::CreateGeometry | |
85 | // Float_t dstation[5]={20., 20., 20, 20., 20.}; | |
86 | // for tracking chambers, | |
87 | // according to (Z1 = zch - dstation) and (Z2 = zch + dstation) | |
88 | // for the first and second chambers in the station, respectively, | |
89 | // and from "DTPLANES" in AliMUONv1::CreateGeometry | |
90 | // const Float_t DTPLANES = 15.; | |
91 | // for trigger chambers, | |
92 | // according to (Z1 = zch) and (Z2 = zch + DTPLANES) | |
93 | // for the first and second chambers in the station, respectively | |
fe4da5cc | 94 | |
fe4da5cc | 95 | ClassImp(AliMUON) |
30178c30 | 96 | |
ce3f5e87 | 97 | //__________________________________________________________________ |
fe4da5cc | 98 | AliMUON::AliMUON() |
30178c30 | 99 | : AliDetector(), |
100 | fNCh(0), | |
101 | fNTrackingCh(0), | |
102 | fMUONData(0), | |
103 | fSplitLevel(0), | |
104 | fChambers(0), | |
30178c30 | 105 | fTriggerCircuits(0), |
d4bb94a1 | 106 | fGeometryBuilder(0), |
504d0837 | 107 | fSegmentation(0), |
30178c30 | 108 | fAccCut(kFALSE), |
109 | fAccMin(0.), | |
110 | fAccMax(0.), | |
111 | fMaxStepGas(0.), | |
112 | fMaxStepAlu(0.), | |
113 | fMaxDestepGas(0.), | |
114 | fMaxDestepAlu(0.), | |
115 | fMaxIterPad(0), | |
ced309a5 | 116 | fCurIterPad(0), |
68585390 | 117 | fTriggerScalerEvent(kFALSE), |
118 | fSDigitizerType(""), | |
d5609cfc | 119 | fDigitizerType(""), |
120 | fRawWriter(0x0) | |
fe4da5cc | 121 | { |
d19b6003 | 122 | /// Default Constructor |
123 | ||
124 | AliDebug(1,Form("default (empty) ctor this=%p",this)); | |
1bd26093 | 125 | fIshunt = 0; |
fe4da5cc | 126 | } |
30178c30 | 127 | |
ce3f5e87 | 128 | //__________________________________________________________________ |
68585390 | 129 | AliMUON::AliMUON(const char *name, const char *title, |
130 | const char* sDigitizerClassName, | |
131 | const char* digitizerClassName) | |
30178c30 | 132 | : AliDetector(name,title), |
133 | fNCh(AliMUONConstants::NCh()), | |
134 | fNTrackingCh(AliMUONConstants::NTrackingCh()), | |
135 | fMUONData(0), | |
136 | fSplitLevel(0), | |
137 | fChambers(0), | |
30178c30 | 138 | fTriggerCircuits(0), |
d4bb94a1 | 139 | fGeometryBuilder(0), |
504d0837 | 140 | fSegmentation(0), |
30178c30 | 141 | fAccCut(kFALSE), |
142 | fAccMin(0.), | |
143 | fAccMax(0.), | |
144 | fMaxStepGas(0.1), | |
145 | fMaxStepAlu(0.1), | |
146 | fMaxDestepGas(-1), // Negatives values are ignored by geant3 CONS200 | |
147 | fMaxDestepAlu(-1), // in the calculation of the tracking parameters | |
148 | fMaxIterPad(0), | |
ced309a5 | 149 | fCurIterPad(0), |
68585390 | 150 | fTriggerScalerEvent(kFALSE), |
151 | fSDigitizerType(sDigitizerClassName), | |
d5609cfc | 152 | fDigitizerType(digitizerClassName), |
153 | fRawWriter(0x0) | |
fe4da5cc | 154 | { |
d19b6003 | 155 | /// Standard constructor |
156 | ||
157 | AliDebug(1,Form("ctor this=%p",this)); | |
30178c30 | 158 | fIshunt = 0; |
a897a37a | 159 | |
ce3f5e87 | 160 | SetMarkerColor(kRed);// |
e118b27e | 161 | |
162 | // Geometry builder | |
163 | fGeometryBuilder = new AliMUONGeometryBuilder(this); | |
164 | ||
165 | // Common geometry definitions | |
166 | fGeometryBuilder | |
167 | ->AddBuilder(new AliMUONCommonGeometryBuilder(this)); | |
168 | ||
d5609cfc | 169 | // By default, add also all the needed geometry builders. |
170 | // If you want to change this from outside, please use ResetGeometryBuilder | |
171 | // method, followed by AddGeometryBuilder ones. | |
172 | ||
173 | AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(this)); | |
174 | AddGeometryBuilder(new AliMUONSt2GeometryBuilderV2(this)); | |
175 | AddGeometryBuilder(new AliMUONSlatGeometryBuilder(this)); | |
176 | AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(this)); | |
177 | ||
178 | // | |
179 | // Creating List of Chambers | |
a9e2aefa | 180 | Int_t ch; |
f665c1ea | 181 | fChambers = new TObjArray(AliMUONConstants::NCh()); |
d1cd2474 | 182 | |
a9e2aefa | 183 | // Loop over stations |
f665c1ea | 184 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { |
a9e2aefa | 185 | // Loop over 2 chambers in the station |
ce3f5e87 | 186 | for (Int_t stCH = 0; stCH < 2; stCH++) { |
187 | // | |
188 | // | |
189 | // Default Parameters for Muon Tracking Stations | |
190 | ch = 2 * st + stCH; | |
191 | if (ch < AliMUONConstants::NTrackingCh()) { | |
192 | fChambers->AddAt(new AliMUONChamber(ch),ch); | |
193 | } else { | |
504d0837 | 194 | fChambers->AddAt(new AliMUONChamberTrigger(ch, GetGeometryTransformer()),ch); |
ce3f5e87 | 195 | } |
ce3f5e87 | 196 | } // Chamber stCH (0, 1) in |
a9e2aefa | 197 | } // Station st (0...) |
ce3f5e87 | 198 | |
ce3f5e87 | 199 | // cp new design of AliMUONTriggerDecision |
200 | fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit()); | |
201 | for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) { | |
202 | fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ); | |
203 | } | |
fe4da5cc | 204 | } |
30178c30 | 205 | |
ce3f5e87 | 206 | //____________________________________________________________________ |
30178c30 | 207 | AliMUON::AliMUON(const AliMUON& rMUON) |
208 | : AliDetector(rMUON) | |
a9e2aefa | 209 | { |
d19b6003 | 210 | /// Protected copy constructor |
30178c30 | 211 | |
8c343c7c | 212 | AliFatal("Not implemented."); |
a9e2aefa | 213 | } |
30178c30 | 214 | |
ce3f5e87 | 215 | //____________________________________________________________________ |
fe4da5cc | 216 | AliMUON::~AliMUON() |
217 | { | |
d19b6003 | 218 | /// Destructor |
219 | ||
edee5e63 | 220 | AliDebug(1,Form("dtor this=%p",this)); |
ce3f5e87 | 221 | fIshunt = 0; |
d1cd2474 | 222 | |
c6df4ef2 | 223 | if (fChambers){ |
224 | fChambers->Delete(); | |
225 | delete fChambers; | |
226 | } | |
227 | if (fTriggerCircuits){ | |
228 | fTriggerCircuits->Delete(); | |
229 | delete fTriggerCircuits; | |
230 | } | |
231 | delete fMUONData; | |
d4bb94a1 | 232 | delete fGeometryBuilder; |
504d0837 | 233 | delete fSegmentation; |
d5609cfc | 234 | delete fRawWriter; |
d1cd2474 | 235 | } |
30178c30 | 236 | |
237 | //________________________________________________________________________ | |
238 | AliMUON& AliMUON::operator = (const AliMUON& rhs) | |
239 | { | |
d19b6003 | 240 | /// Protected assignement operator |
30178c30 | 241 | |
242 | if (this == &rhs) return *this; | |
243 | ||
8c343c7c | 244 | AliFatal("Not implemented."); |
30178c30 | 245 | |
246 | return *this; | |
247 | } | |
248 | ||
d1cd2474 | 249 | //_____________________________________________________________________________ |
250 | void AliMUON::AddGeometryBuilder(AliMUONVGeometryBuilder* geomBuilder) | |
251 | { | |
d19b6003 | 252 | /// Add the geometry builder to the list |
d1cd2474 | 253 | |
d4bb94a1 | 254 | fGeometryBuilder->AddBuilder(geomBuilder); |
a897a37a | 255 | } |
c9d10ab5 | 256 | |
ce3f5e87 | 257 | //____________________________________________________________________ |
fe4da5cc | 258 | void AliMUON::BuildGeometry() |
259 | { | |
d19b6003 | 260 | /// Geometry for event display |
c9d10ab5 | 261 | |
002920d1 | 262 | |
ae89d471 | 263 | // for (Int_t i = 0; i < AliMUONConstants::NCh(); i++) |
264 | // this->Chamber(i).SegmentationModel2(1)->Draw("eventdisplay");// to be check ! | |
265 | ||
002920d1 | 266 | |
fe4da5cc | 267 | } |
c9d10ab5 | 268 | |
504d0837 | 269 | //____________________________________________________________________ |
270 | const AliMUONGeometry* AliMUON::GetGeometry() const | |
271 | { | |
d19b6003 | 272 | /// Return geometry parametrisation |
504d0837 | 273 | |
274 | if ( !fGeometryBuilder) { | |
275 | AliWarningStream() << "GeometryBuilder not defined." << std::endl; | |
276 | return 0; | |
277 | } | |
278 | ||
279 | return fGeometryBuilder->GetGeometry(); | |
280 | } | |
281 | ||
282 | //____________________________________________________________________ | |
283 | const AliMUONGeometryTransformer* AliMUON::GetGeometryTransformer() const | |
284 | { | |
d19b6003 | 285 | /// Return geometry parametrisation |
504d0837 | 286 | |
287 | const AliMUONGeometry* kGeometry = GetGeometry(); | |
288 | ||
289 | if ( !kGeometry) return 0; | |
290 | ||
291 | return kGeometry->GetTransformer(); | |
292 | } | |
293 | ||
ce3f5e87 | 294 | //__________________________________________________________________ |
295 | void AliMUON::SetTreeAddress() | |
a897a37a | 296 | { |
d19b6003 | 297 | /// Set Hits tree address |
298 | ||
ce3f5e87 | 299 | GetMUONData()->SetLoader(fLoader); |
d1775029 | 300 | // GetMUONData()->MakeBranch("D,S,RC"); |
301 | // GetMUONData()->SetTreeAddress("H,D,S,RC"); | |
52c9bc11 | 302 | GetMUONData()->SetTreeAddress("H"); |
307d9d04 | 303 | if (fHits != GetMUONData()->Hits()) { |
ae31c826 | 304 | if ( gAlice->GetMCApp() ) |
6d2f7cbd | 305 | if ( gAlice->GetMCApp()->GetHitLists() ) { |
306 | fHits = GetMUONData()->Hits(); | |
307 | gAlice->GetMCApp()->AddHitList(fHits); // For purifyKine, only necessary when Hit list is created in AliMUONData | |
308 | } | |
307d9d04 | 309 | } |
6d2f7cbd | 310 | fHits = GetMUONData()->Hits(); // Added by Ivana to use the methods FisrtHit, NextHit of AliDetector |
a9e2aefa | 311 | } |
312 | ||
ce3f5e87 | 313 | //_________________________________________________________________ |
a897a37a | 314 | void AliMUON::SetChargeSlope(Int_t id, Float_t p1) |
fe4da5cc | 315 | { |
d19b6003 | 316 | /// Set the inverse charge slope for chamber id |
317 | ||
ce3f5e87 | 318 | Int_t i=2*(id-1); //PH ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1); |
319 | //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1); | |
2682e810 | 320 | ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1); |
321 | ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1); | |
fe4da5cc | 322 | } |
ce3f5e87 | 323 | //__________________________________________________________________ |
a897a37a | 324 | void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2) |
fe4da5cc | 325 | { |
d19b6003 | 326 | /// Set sigma of charge spread for chamber id |
327 | ||
fe4da5cc | 328 | Int_t i=2*(id-1); |
2682e810 | 329 | ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2); |
330 | ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2); | |
fe4da5cc | 331 | } |
ce3f5e87 | 332 | //___________________________________________________________________ |
a897a37a | 333 | void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1) |
fe4da5cc | 334 | { |
d19b6003 | 335 | /// Set integration limits for charge spread |
fe4da5cc | 336 | Int_t i=2*(id-1); |
2682e810 | 337 | ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1); |
338 | ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1); | |
fe4da5cc | 339 | } |
340 | ||
ce3f5e87 | 341 | //__________________________________________________________________ |
d09fafb0 | 342 | void AliMUON::SetMaxAdc(Int_t id, Int_t p1) |
fe4da5cc | 343 | { |
d19b6003 | 344 | /// Set maximum number for ADCcounts (saturation) |
345 | ||
fe4da5cc | 346 | Int_t i=2*(id-1); |
2682e810 | 347 | ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1); |
348 | ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1); | |
fe4da5cc | 349 | } |
d4bb94a1 | 350 | |
ce3f5e87 | 351 | //__________________________________________________________________ |
a897a37a | 352 | void AliMUON::SetMaxStepGas(Float_t p1) |
fe4da5cc | 353 | { |
d19b6003 | 354 | /// Set stepsize in gas |
355 | ||
ce3f5e87 | 356 | fMaxStepGas=p1; |
fe4da5cc | 357 | } |
ce3f5e87 | 358 | //__________________________________________________________________ |
a897a37a | 359 | void AliMUON::SetMaxStepAlu(Float_t p1) |
fe4da5cc | 360 | { |
d19b6003 | 361 | /// Set step size in Alu |
362 | ||
fe4da5cc | 363 | fMaxStepAlu=p1; |
364 | } | |
ce3f5e87 | 365 | //__________________________________________________________________ |
a897a37a | 366 | void AliMUON::SetMaxDestepGas(Float_t p1) |
fe4da5cc | 367 | { |
d19b6003 | 368 | /// Set maximum step size in Gas |
369 | ||
fe4da5cc | 370 | fMaxDestepGas=p1; |
371 | } | |
ce3f5e87 | 372 | //__________________________________________________________________ |
a897a37a | 373 | void AliMUON::SetMaxDestepAlu(Float_t p1) |
fe4da5cc | 374 | { |
d19b6003 | 375 | /// Set maximum step size in Alu |
376 | ||
ce3f5e87 | 377 | fMaxDestepAlu=p1; |
fe4da5cc | 378 | } |
d4bb94a1 | 379 | |
d1cd2474 | 380 | //____________________________________________________________________ |
381 | Float_t AliMUON::GetMaxStepGas() const | |
382 | { | |
d19b6003 | 383 | /// Return stepsize in gas |
d1cd2474 | 384 | |
385 | return fMaxStepGas; | |
386 | } | |
387 | ||
388 | //____________________________________________________________________ | |
389 | Float_t AliMUON::GetMaxStepAlu() const | |
390 | { | |
d19b6003 | 391 | /// Return step size in Alu |
d1cd2474 | 392 | |
393 | return fMaxStepAlu; | |
394 | } | |
395 | ||
396 | //____________________________________________________________________ | |
397 | Float_t AliMUON::GetMaxDestepGas() const | |
398 | { | |
d19b6003 | 399 | /// Return maximum step size in Gas |
d1cd2474 | 400 | |
401 | return fMaxDestepGas; | |
402 | } | |
403 | ||
404 | //____________________________________________________________________ | |
405 | Float_t AliMUON::GetMaxDestepAlu() const | |
406 | { | |
d19b6003 | 407 | /// Return maximum step size in Gas |
d1cd2474 | 408 | |
409 | return fMaxDestepAlu; | |
410 | } | |
d4bb94a1 | 411 | |
883746f3 | 412 | //____________________________________________________________________ |
413 | void AliMUON::SetAlign(Bool_t align) | |
a713db22 | 414 | { |
d19b6003 | 415 | /// Set option for alignement to geometry builder |
883746f3 | 416 | |
417 | fGeometryBuilder->SetAlign(align); | |
418 | } | |
fe4da5cc | 419 | |
82d1ac0a | 420 | //____________________________________________________________________ |
421 | void AliMUON::SetAlign(const TString& fileName, Bool_t align) | |
422 | { | |
d19b6003 | 423 | /// Set option for alignement to geometry builder |
82d1ac0a | 424 | |
425 | fGeometryBuilder->SetAlign(fileName, align); | |
426 | } | |
427 | ||
ce3f5e87 | 428 | //____________________________________________________________________ |
a9e2aefa | 429 | void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response) |
fe4da5cc | 430 | { |
d19b6003 | 431 | /// Set the response for chamber id |
2682e810 | 432 | ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response); |
fe4da5cc | 433 | } |
d19b6003 | 434 | |
ce3f5e87 | 435 | //____________________________________________________________________ |
c92eb8ad | 436 | AliDigitizer* AliMUON::CreateDigitizer(AliRunDigitizer* manager) const |
85a5290f | 437 | { |
d19b6003 | 438 | /// FIXME: the selection of the class should be done through a factory |
439 | /// mechanism. (see also Hits2SDigits()). | |
68585390 | 440 | |
441 | AliInfo(Form("Digitizer used : %s",fDigitizerType.Data())); | |
442 | ||
443 | if ( fDigitizerType == "digitizer:default" ) | |
444 | { | |
445 | return new AliMUONDigitizerv2(manager); | |
446 | } | |
447 | else if ( fDigitizerType == "digitizer:NewDigitizerNewTrigger" ) | |
448 | { | |
449 | return new AliMUONDigitizerV3(manager,AliMUONDigitizerV3::kTriggerElectronics); | |
450 | } | |
451 | else if ( fDigitizerType == "digitizer:NewDigitizerOldTrigger" ) | |
452 | { | |
4142b82d | 453 | return new AliMUONDigitizerV3(manager,AliMUONDigitizerV3::kTriggerDecision, kFALSE, kFALSE); |
68585390 | 454 | } |
4142b82d | 455 | else if ( fDigitizerType == "digitizer:NewDigitizerEffTrigger" ) |
456 | { | |
457 | return new AliMUONDigitizerV3(manager,AliMUONDigitizerV3::kTriggerDecision, kTRUE, kFALSE); | |
458 | } | |
459 | else if ( fDigitizerType == "digitizer:NewDigitizerWithNoiseOldTrigger" ) | |
460 | { | |
461 | return new AliMUONDigitizerV3(manager,AliMUONDigitizerV3::kTriggerDecision, kFALSE, kTRUE); | |
462 | } | |
68585390 | 463 | else |
464 | { | |
465 | AliFatal(Form("Unknown digitizer type : %s",fDigitizerType.Data())); | |
466 | } | |
467 | return 0x0; | |
468 | } | |
469 | ||
470 | //_____________________________________________________________________ | |
471 | TString | |
472 | AliMUON::SDigitizerType() const | |
473 | { | |
d19b6003 | 474 | /// Return digitizer type |
475 | ||
68585390 | 476 | return fSDigitizerType; |
85a5290f | 477 | } |
68585390 | 478 | |
ce3f5e87 | 479 | //_____________________________________________________________________ |
2ab0c725 | 480 | void AliMUON::SDigits2Digits() |
481 | { | |
d19b6003 | 482 | /// Write TreeD here only |
d963c261 | 483 | |
d963c261 | 484 | char hname[30]; |
88cb7938 | 485 | // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent()); |
486 | fLoader->TreeD()->Write(hname,TObject::kOverwrite); | |
487 | fLoader->TreeD()->Reset(); | |
2ab0c725 | 488 | } |
a9e2aefa | 489 | |
d1775029 | 490 | //_____________________________________________________________________ |
491 | void AliMUON::Hits2SDigits() | |
492 | { | |
d19b6003 | 493 | /// FIXME: the selection of the sdigitizer should be done through a |
494 | /// factory mechanism. | |
68585390 | 495 | |
496 | AliInfo(Form("SDigitizer used : %s",fSDigitizerType.Data())); | |
497 | ||
498 | if ( fSDigitizerType == "sdigitizer:default" ) | |
499 | { | |
500 | // Adaption of AliMUONSDigitizerv1 to be excuted by the AliSimulation framework | |
501 | AliRunLoader* runLoader = fLoader->GetRunLoader(); | |
502 | AliRunDigitizer * manager = new AliRunDigitizer(1,1); | |
503 | manager->SetInputStream(0,runLoader->GetFileName(),AliConfig::GetDefaultEventFolderName()); | |
504 | AliMUONDigitizer * dMUON = new AliMUONSDigitizerv1(manager); | |
505 | fLoader->LoadHits("READ"); | |
506 | for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) { | |
507 | runLoader->GetEvent(iEvent); | |
508 | dMUON->Exec(""); | |
509 | } | |
510 | fLoader->UnloadHits(); | |
511 | } | |
512 | else if ( fSDigitizerType == "sdigitizer:AliMUONSDigitizerV2" ) | |
513 | { | |
514 | TTask* sdigitizer = new AliMUONSDigitizerV2; | |
515 | sdigitizer->ExecuteTask(); | |
dbb4e169 | 516 | } |
68585390 | 517 | else |
518 | { | |
519 | AliFatal(Form("Unknown sdigitizer classname : %s",fSDigitizerType.Data())); | |
520 | } | |
521 | } | |
522 | ||
523 | //_____________________________________________________________________ | |
524 | TString | |
525 | AliMUON::DigitizerType() const | |
526 | { | |
d19b6003 | 527 | /// Return digitizer type |
528 | ||
68585390 | 529 | return fDigitizerType; |
d1775029 | 530 | } |
68585390 | 531 | |
39e39255 | 532 | //_____________________________________________________________________ |
533 | void AliMUON::Digits2Raw() | |
534 | { | |
d19b6003 | 535 | /// Convert digits of the current event to raw data |
536 | ||
d5609cfc | 537 | if (!fRawWriter) |
538 | { | |
539 | fRawWriter = new AliMUONRawWriter(fMUONData); | |
540 | if (fTriggerScalerEvent == kTRUE) | |
541 | { | |
542 | fRawWriter->SetScalerEvent(); | |
543 | } | |
544 | } | |
545 | ||
546 | if (!fRawWriter->Digits2Raw()) | |
547 | { | |
548 | AliError("pb writting raw data"); | |
549 | } | |
39e39255 | 550 | } |
68585390 | 551 | |
ce3f5e87 | 552 | //_______________________________________________________________________ |
3fa6cfdd | 553 | AliLoader* AliMUON::MakeLoader(const char* topfoldername) |
554 | { | |
d19b6003 | 555 | /// Build standard getter (AliLoader type); |
556 | /// if detector wants to use castomized getter, it must overload this method | |
8c343c7c | 557 | |
558 | AliDebug(1,Form("Creating standard getter for detector %s. Top folder is %s.", | |
559 | GetName(),topfoldername)); | |
128843d9 | 560 | fLoader = new AliLoader(GetName(),topfoldername); |
ce3f5e87 | 561 | fMUONData = new AliMUONData(fLoader,GetName(),GetName()); |
d652f85c | 562 | fMUONData->SetSplitLevel(fSplitLevel); |
3fa6cfdd | 563 | return fLoader; |
564 | } | |
ce3f5e87 | 565 | //_______________________________________________________________________ |
a897a37a | 566 | |
567 | AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster) | |
568 | { | |
d19b6003 | 569 | /// Return rawcluster (icluster) for chamber ichamber and cathode icathod |
570 | /// Obsolete ?? | |
571 | ||
ce3f5e87 | 572 | TClonesArray *muonRawCluster = GetMUONData()->RawClusters(ichamber); |
a897a37a | 573 | ResetRawClusters(); |
88cb7938 | 574 | TTree *treeR = fLoader->TreeR(); |
a9e2aefa | 575 | Int_t nent=(Int_t)treeR->GetEntries(); |
576 | treeR->GetEvent(nent-2+icathod-1); | |
577 | //treeR->GetEvent(icathod); | |
578 | //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast(); | |
a897a37a | 579 | |
a9e2aefa | 580 | AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster); |
a897a37a | 581 | //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw); |
582 | ||
583 | return mRaw; | |
584 | } | |
ffd9faa2 | 585 | |
d5609cfc | 586 | //________________________________________________________________________ |
587 | void | |
588 | AliMUON::ResetGeometryBuilder() | |
589 | { | |
d19b6003 | 590 | /// Only to be used by "experts" wanting to change the geometry builders |
591 | /// to be used. | |
592 | /// As the ctor of AliMUON now defines a default geometrybuilder, this | |
593 | /// ResetGeometryBuilder() must be called prior to call the | |
594 | /// AddGeometryBuilder() | |
595 | ||
d5609cfc | 596 | delete fGeometryBuilder; |
597 | fGeometryBuilder = new AliMUONGeometryBuilder(this); | |
598 | fGeometryBuilder | |
599 | ->AddBuilder(new AliMUONCommonGeometryBuilder(this)); | |
600 | } |