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