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