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