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