]>
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 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
d19b6003 | 19 | // Class AliMUON |
20 | // ------------------ | |
21 | // AliDetector class for MUON subsystem | |
22 | // providing simulation data management | |
3d1463c8 | 23 | //----------------------------------------------------------------------------- |
fe4da5cc | 24 | |
4069c48e | 25 | #include "AliMUON.h" |
88cb7938 | 26 | |
4069c48e | 27 | #include "AliMUONSDigitizerV2.h" |
28 | #include "AliMUONDigitizerV3.h" | |
29 | #include "AliMUONDigitMaker.h" | |
5d950f54 | 30 | #include "AliMUONDigit.h" |
4069c48e | 31 | #include "AliMUONCalibrationData.h" |
32 | ||
33 | #include "AliMUONDigitStoreV1.h" | |
c3305598 | 34 | #include "AliMUONTriggerStoreV1.h" |
4069c48e | 35 | #include "AliMUONHitStoreV1.h" |
fe4da5cc | 36 | |
88cb7938 | 37 | #include "AliMUONChamberTrigger.h" |
88cb7938 | 38 | #include "AliMUONConstants.h" |
504d0837 | 39 | #include "AliMUONGeometry.h" |
40 | #include "AliMUONGeometryTransformer.h" | |
d4bb94a1 | 41 | #include "AliMUONGeometryBuilder.h" |
d1cd2474 | 42 | #include "AliMUONVGeometryBuilder.h" |
4069c48e | 43 | #include "AliMUONCommonGeometryBuilder.h" |
d5609cfc | 44 | #include "AliMUONSt1GeometryBuilderV2.h" |
45 | #include "AliMUONSt2GeometryBuilderV2.h" | |
46 | #include "AliMUONSlatGeometryBuilder.h" | |
47 | #include "AliMUONTriggerGeometryBuilder.h" | |
5d950f54 | 48 | #include "AliMUONDigitCalibrator.h" |
49 | #include "AliMUONRecoParam.h" | |
50 | #include "AliCDBManager.h" | |
51 | #include "AliCDBEntry.h" | |
d5609cfc | 52 | |
4069c48e | 53 | #include "AliMUONRawWriter.h" |
54 | ||
55 | #include "AliLoader.h" | |
56 | #include "AliCDBManager.h" | |
57 | #include "AliRunDigitizer.h" | |
58 | #include "AliMC.h" | |
59 | #include "AliRun.h" | |
60 | #include "AliRawDataHeaderSim.h" | |
61 | #include "AliLog.h" | |
62 | ||
63 | #include <TObjArray.h> | |
7435e1f8 | 64 | |
a9e2aefa | 65 | // Defaults parameters for Z positions of chambers |
66 | // taken from values for "stations" in AliMUON::AliMUON | |
67 | // const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.}; | |
68 | // and from array "dstation" in AliMUONv1::CreateGeometry | |
69 | // Float_t dstation[5]={20., 20., 20, 20., 20.}; | |
70 | // for tracking chambers, | |
71 | // according to (Z1 = zch - dstation) and (Z2 = zch + dstation) | |
72 | // for the first and second chambers in the station, respectively, | |
73 | // and from "DTPLANES" in AliMUONv1::CreateGeometry | |
74 | // const Float_t DTPLANES = 15.; | |
75 | // for trigger chambers, | |
76 | // according to (Z1 = zch) and (Z2 = zch + DTPLANES) | |
77 | // for the first and second chambers in the station, respectively | |
fe4da5cc | 78 | |
13985652 | 79 | /// \cond CLASSIMP |
80 | ClassImp(AliMUON) | |
81 | /// \endcond | |
30178c30 | 82 | |
ce3f5e87 | 83 | //__________________________________________________________________ |
fe4da5cc | 84 | AliMUON::AliMUON() |
30178c30 | 85 | : AliDetector(), |
86 | fNCh(0), | |
87 | fNTrackingCh(0), | |
30178c30 | 88 | fSplitLevel(0), |
89 | fChambers(0), | |
d4bb94a1 | 90 | fGeometryBuilder(0), |
30178c30 | 91 | fAccCut(kFALSE), |
92 | fAccMin(0.), | |
93 | fAccMax(0.), | |
94 | fMaxStepGas(0.), | |
95 | fMaxStepAlu(0.), | |
96 | fMaxDestepGas(0.), | |
97 | fMaxDestepAlu(0.), | |
98 | fMaxIterPad(0), | |
ced309a5 | 99 | fCurIterPad(0), |
d631bec8 | 100 | fIsMaxStep(kTRUE), |
68585390 | 101 | fTriggerScalerEvent(kFALSE), |
e93b11d0 | 102 | fTriggerResponseV1(kFALSE), |
103 | fTriggerCoinc44(0), | |
afb3ccf0 | 104 | fTriggerEffCells(0), |
8c0b5e70 | 105 | fDigitizerWithNoise(1), |
5c083cba | 106 | fDigitizerNSigmas(4.0), |
5fe36481 | 107 | fIsTailEffect(kTRUE), |
c3305598 | 108 | fConvertTrigger(kFALSE), |
241560c2 | 109 | fRawWriter(0x0), |
7435e1f8 | 110 | fDigitMaker(0x0), |
5ee595ac | 111 | fHitStore(0x0), |
92c23b09 | 112 | fDigitStoreConcreteClassName(), |
5d950f54 | 113 | fCalibrationData(0x0), |
114 | fDigitCalibrator(0x0) | |
fe4da5cc | 115 | { |
d19b6003 | 116 | /// Default Constructor |
117 | ||
118 | AliDebug(1,Form("default (empty) ctor this=%p",this)); | |
1bd26093 | 119 | fIshunt = 0; |
fe4da5cc | 120 | } |
30178c30 | 121 | |
ce3f5e87 | 122 | //__________________________________________________________________ |
9bf406e1 | 123 | AliMUON::AliMUON(const char *name, const char* title) |
124 | : AliDetector(name, title), | |
30178c30 | 125 | fNCh(AliMUONConstants::NCh()), |
126 | fNTrackingCh(AliMUONConstants::NTrackingCh()), | |
30178c30 | 127 | fSplitLevel(0), |
128 | fChambers(0), | |
d4bb94a1 | 129 | fGeometryBuilder(0), |
30178c30 | 130 | fAccCut(kFALSE), |
131 | fAccMin(0.), | |
132 | fAccMax(0.), | |
133 | fMaxStepGas(0.1), | |
134 | fMaxStepAlu(0.1), | |
135 | fMaxDestepGas(-1), // Negatives values are ignored by geant3 CONS200 | |
136 | fMaxDestepAlu(-1), // in the calculation of the tracking parameters | |
137 | fMaxIterPad(0), | |
ced309a5 | 138 | fCurIterPad(0), |
d631bec8 | 139 | fIsMaxStep(kTRUE), |
e93b11d0 | 140 | fTriggerScalerEvent(kFALSE), |
141 | fTriggerResponseV1(kFALSE), | |
142 | fTriggerCoinc44(0), | |
afb3ccf0 | 143 | fTriggerEffCells(0), |
8c0b5e70 | 144 | fDigitizerWithNoise(1), |
5c083cba | 145 | fDigitizerNSigmas(4.0), |
5fe36481 | 146 | fIsTailEffect(kTRUE), |
c3305598 | 147 | fConvertTrigger(kFALSE), |
241560c2 | 148 | fRawWriter(0x0), |
7435e1f8 | 149 | fDigitMaker(new AliMUONDigitMaker), |
5ee595ac | 150 | fHitStore(0x0), |
92c23b09 | 151 | fDigitStoreConcreteClassName("AliMUONDigitStoreV2S"), |
5d950f54 | 152 | fCalibrationData(), |
153 | fDigitCalibrator(0x0) | |
fe4da5cc | 154 | { |
92c23b09 | 155 | /// Standard constructor |
d19b6003 | 156 | |
157 | AliDebug(1,Form("ctor this=%p",this)); | |
30178c30 | 158 | fIshunt = 0; |
92c23b09 | 159 | |
e939a978 | 160 | //PH SetMarkerColor(kRed);// |
e118b27e | 161 | |
162 | // Geometry builder | |
163 | fGeometryBuilder = new AliMUONGeometryBuilder(this); | |
164 | ||
165 | // Common geometry definitions | |
166 | fGeometryBuilder | |
167 | ->AddBuilder(new AliMUONCommonGeometryBuilder(this)); | |
92c23b09 | 168 | |
d5609cfc | 169 | // By default, add also all the needed geometry builders. |
170 | // If you want to change this from outside, please use ResetGeometryBuilder | |
171 | // method, followed by AddGeometryBuilder ones. | |
92c23b09 | 172 | |
d5609cfc | 173 | AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(this)); |
174 | AddGeometryBuilder(new AliMUONSt2GeometryBuilderV2(this)); | |
175 | AddGeometryBuilder(new AliMUONSlatGeometryBuilder(this)); | |
176 | AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(this)); | |
177 | ||
178 | // | |
179 | // Creating List of Chambers | |
a9e2aefa | 180 | Int_t ch; |
f665c1ea | 181 | fChambers = new TObjArray(AliMUONConstants::NCh()); |
7435e1f8 | 182 | fChambers->SetOwner(kTRUE); |
183 | ||
a9e2aefa | 184 | // Loop over stations |
f665c1ea | 185 | for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) { |
a9e2aefa | 186 | // Loop over 2 chambers in the station |
ce3f5e87 | 187 | for (Int_t stCH = 0; stCH < 2; stCH++) { |
188 | // | |
189 | // | |
190 | // Default Parameters for Muon Tracking Stations | |
191 | ch = 2 * st + stCH; | |
192 | if (ch < AliMUONConstants::NTrackingCh()) { | |
193 | fChambers->AddAt(new AliMUONChamber(ch),ch); | |
194 | } else { | |
504d0837 | 195 | fChambers->AddAt(new AliMUONChamberTrigger(ch, GetGeometryTransformer()),ch); |
ce3f5e87 | 196 | } |
ce3f5e87 | 197 | } // Chamber stCH (0, 1) in |
a9e2aefa | 198 | } // Station st (0...) |
92c23b09 | 199 | |
200 | Int_t runnumber = AliCDBManager::Instance()->GetRun(); | |
201 | ||
202 | fCalibrationData = new AliMUONCalibrationData(runnumber); | |
fe4da5cc | 203 | } |
30178c30 | 204 | |
ce3f5e87 | 205 | //____________________________________________________________________ |
fe4da5cc | 206 | AliMUON::~AliMUON() |
207 | { | |
d19b6003 | 208 | /// Destructor |
209 | ||
edee5e63 | 210 | AliDebug(1,Form("dtor this=%p",this)); |
7435e1f8 | 211 | delete fChambers; |
d4bb94a1 | 212 | delete fGeometryBuilder; |
d5609cfc | 213 | delete fRawWriter; |
241560c2 | 214 | delete fDigitMaker; |
7435e1f8 | 215 | delete fHitStore; |
92c23b09 | 216 | delete fCalibrationData; |
5d950f54 | 217 | delete fDigitCalibrator; |
d1cd2474 | 218 | } |
30178c30 | 219 | |
d1cd2474 | 220 | //_____________________________________________________________________________ |
221 | void AliMUON::AddGeometryBuilder(AliMUONVGeometryBuilder* geomBuilder) | |
222 | { | |
d19b6003 | 223 | /// Add the geometry builder to the list |
d1cd2474 | 224 | |
d4bb94a1 | 225 | fGeometryBuilder->AddBuilder(geomBuilder); |
a897a37a | 226 | } |
c9d10ab5 | 227 | |
504d0837 | 228 | //____________________________________________________________________ |
229 | const AliMUONGeometry* AliMUON::GetGeometry() const | |
230 | { | |
d19b6003 | 231 | /// Return geometry parametrisation |
504d0837 | 232 | |
233 | if ( !fGeometryBuilder) { | |
234 | AliWarningStream() << "GeometryBuilder not defined." << std::endl; | |
235 | return 0; | |
236 | } | |
237 | ||
238 | return fGeometryBuilder->GetGeometry(); | |
239 | } | |
240 | ||
241 | //____________________________________________________________________ | |
242 | const AliMUONGeometryTransformer* AliMUON::GetGeometryTransformer() const | |
243 | { | |
d19b6003 | 244 | /// Return geometry parametrisation |
504d0837 | 245 | |
246 | const AliMUONGeometry* kGeometry = GetGeometry(); | |
247 | ||
248 | if ( !kGeometry) return 0; | |
249 | ||
250 | return kGeometry->GetTransformer(); | |
251 | } | |
252 | ||
ce3f5e87 | 253 | //__________________________________________________________________ |
7435e1f8 | 254 | void |
255 | AliMUON::MakeBranch(Option_t* opt) | |
a897a37a | 256 | { |
7435e1f8 | 257 | /// Create branche(s) to hold MUON hits |
258 | AliDebug(1,""); | |
259 | ||
260 | TString sopt(opt); | |
261 | if ( sopt != "H" ) return; | |
262 | ||
263 | if (!fHitStore) | |
264 | { | |
265 | fHitStore = new AliMUONHitStoreV1; | |
ae31c826 | 266 | if ( gAlice->GetMCApp() ) |
7435e1f8 | 267 | { |
268 | if ( gAlice->GetMCApp()->GetHitLists() ) | |
269 | { | |
270 | // AliStack::PurifyKine needs to be able to loop on our hits | |
271 | // to remap the track numbers. | |
272 | gAlice->GetMCApp()->AddHitList(fHitStore->Collection()); | |
6d2f7cbd | 273 | } |
7435e1f8 | 274 | } |
275 | } | |
276 | ||
277 | TTree* treeH = fLoader->TreeH(); | |
278 | ||
279 | if (!treeH) | |
280 | { | |
281 | AliFatal("No TreeH"); | |
307d9d04 | 282 | } |
7435e1f8 | 283 | |
284 | fHitStore->Connect(*treeH); | |
285 | } | |
286 | ||
287 | //__________________________________________________________________ | |
288 | void | |
289 | AliMUON::SetTreeAddress() | |
290 | { | |
291 | /// Set Hits tree address | |
292 | ||
293 | // if ( gAlice->GetMCApp() && fHitStore ) | |
294 | // { | |
295 | // TList* l = gAlice->GetMCApp()->GetHitLists(); | |
296 | // if ( l ) | |
297 | // { | |
298 | // TObject* o = l->First(); | |
299 | // if (o!=fHitStore->HitCollection()) | |
300 | // { | |
301 | // AliError(Form("Something is strange hitcollection=%x",fHitStore->HitCollection())); | |
302 | // l->Print(); | |
303 | // } | |
304 | // } | |
305 | // } | |
306 | } | |
307 | ||
308 | //_________________________________________________________________ | |
309 | void | |
310 | AliMUON::ResetHits() | |
311 | { | |
312 | /// Reset hits | |
313 | ||
314 | AliDebug(1,""); | |
315 | if (fHitStore) fHitStore->Clear(); | |
a9e2aefa | 316 | } |
317 | ||
ce3f5e87 | 318 | //_________________________________________________________________ |
a897a37a | 319 | void AliMUON::SetChargeSlope(Int_t id, Float_t p1) |
fe4da5cc | 320 | { |
d19b6003 | 321 | /// Set the inverse charge slope for chamber id |
322 | ||
ce3f5e87 | 323 | Int_t i=2*(id-1); //PH ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1); |
324 | //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1); | |
2682e810 | 325 | ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1); |
326 | ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1); | |
fe4da5cc | 327 | } |
ce3f5e87 | 328 | //__________________________________________________________________ |
a897a37a | 329 | void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2) |
fe4da5cc | 330 | { |
d19b6003 | 331 | /// Set sigma of charge spread for chamber id |
332 | ||
fe4da5cc | 333 | Int_t i=2*(id-1); |
2682e810 | 334 | ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2); |
335 | ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2); | |
fe4da5cc | 336 | } |
ce3f5e87 | 337 | //___________________________________________________________________ |
a897a37a | 338 | void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1) |
fe4da5cc | 339 | { |
d19b6003 | 340 | /// Set integration limits for charge spread |
fe4da5cc | 341 | Int_t i=2*(id-1); |
2682e810 | 342 | ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1); |
343 | ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1); | |
fe4da5cc | 344 | } |
345 | ||
ce3f5e87 | 346 | //__________________________________________________________________ |
d09fafb0 | 347 | void AliMUON::SetMaxAdc(Int_t id, Int_t p1) |
fe4da5cc | 348 | { |
d19b6003 | 349 | /// Set maximum number for ADCcounts (saturation) |
350 | ||
fe4da5cc | 351 | Int_t i=2*(id-1); |
2682e810 | 352 | ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1); |
353 | ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1); | |
fe4da5cc | 354 | } |
d4bb94a1 | 355 | |
ce3f5e87 | 356 | //__________________________________________________________________ |
a897a37a | 357 | void AliMUON::SetMaxStepGas(Float_t p1) |
fe4da5cc | 358 | { |
d19b6003 | 359 | /// Set stepsize in gas |
360 | ||
ce3f5e87 | 361 | fMaxStepGas=p1; |
fe4da5cc | 362 | } |
ce3f5e87 | 363 | //__________________________________________________________________ |
a897a37a | 364 | void AliMUON::SetMaxStepAlu(Float_t p1) |
fe4da5cc | 365 | { |
d19b6003 | 366 | /// Set step size in Alu |
367 | ||
fe4da5cc | 368 | fMaxStepAlu=p1; |
369 | } | |
ce3f5e87 | 370 | //__________________________________________________________________ |
a897a37a | 371 | void AliMUON::SetMaxDestepGas(Float_t p1) |
fe4da5cc | 372 | { |
d19b6003 | 373 | /// Set maximum step size in Gas |
374 | ||
fe4da5cc | 375 | fMaxDestepGas=p1; |
376 | } | |
ce3f5e87 | 377 | //__________________________________________________________________ |
a897a37a | 378 | void AliMUON::SetMaxDestepAlu(Float_t p1) |
fe4da5cc | 379 | { |
d19b6003 | 380 | /// Set maximum step size in Alu |
381 | ||
ce3f5e87 | 382 | fMaxDestepAlu=p1; |
fe4da5cc | 383 | } |
d4bb94a1 | 384 | |
d1cd2474 | 385 | //____________________________________________________________________ |
386 | Float_t AliMUON::GetMaxStepGas() const | |
387 | { | |
d19b6003 | 388 | /// Return stepsize in gas |
d1cd2474 | 389 | |
390 | return fMaxStepGas; | |
391 | } | |
392 | ||
393 | //____________________________________________________________________ | |
394 | Float_t AliMUON::GetMaxStepAlu() const | |
395 | { | |
d19b6003 | 396 | /// Return step size in Alu |
d1cd2474 | 397 | |
398 | return fMaxStepAlu; | |
399 | } | |
400 | ||
401 | //____________________________________________________________________ | |
402 | Float_t AliMUON::GetMaxDestepGas() const | |
403 | { | |
d19b6003 | 404 | /// Return maximum step size in Gas |
d1cd2474 | 405 | |
406 | return fMaxDestepGas; | |
407 | } | |
408 | ||
409 | //____________________________________________________________________ | |
410 | Float_t AliMUON::GetMaxDestepAlu() const | |
411 | { | |
d19b6003 | 412 | /// Return maximum step size in Gas |
d1cd2474 | 413 | |
414 | return fMaxDestepAlu; | |
415 | } | |
d4bb94a1 | 416 | |
883746f3 | 417 | //____________________________________________________________________ |
418 | void AliMUON::SetAlign(Bool_t align) | |
a713db22 | 419 | { |
d19b6003 | 420 | /// Set option for alignement to geometry builder |
883746f3 | 421 | |
422 | fGeometryBuilder->SetAlign(align); | |
423 | } | |
fe4da5cc | 424 | |
82d1ac0a | 425 | //____________________________________________________________________ |
426 | void AliMUON::SetAlign(const TString& fileName, Bool_t align) | |
427 | { | |
d19b6003 | 428 | /// Set option for alignement to geometry builder |
82d1ac0a | 429 | |
430 | fGeometryBuilder->SetAlign(fileName, align); | |
431 | } | |
432 | ||
ce3f5e87 | 433 | //____________________________________________________________________ |
7435e1f8 | 434 | void AliMUON::SetResponseModel(Int_t id, const AliMUONResponse& response) |
fe4da5cc | 435 | { |
d19b6003 | 436 | /// Set the response for chamber id |
2682e810 | 437 | ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response); |
fe4da5cc | 438 | } |
d19b6003 | 439 | |
ce3f5e87 | 440 | //____________________________________________________________________ |
c92eb8ad | 441 | AliDigitizer* AliMUON::CreateDigitizer(AliRunDigitizer* manager) const |
85a5290f | 442 | { |
a3249004 | 443 | /// Return digitizer |
68585390 | 444 | |
92c23b09 | 445 | AliMUONDigitizerV3* digitizer = new AliMUONDigitizerV3(manager, fDigitizerWithNoise); |
5c083cba | 446 | AliMUONDigitizerV3::SetNSigmas(fDigitizerNSigmas); |
b89ac3d6 | 447 | digitizer->SetCalibrationData(fCalibrationData); |
92c23b09 | 448 | return digitizer; |
85a5290f | 449 | } |
68585390 | 450 | |
ce3f5e87 | 451 | //_____________________________________________________________________ |
2ab0c725 | 452 | void AliMUON::SDigits2Digits() |
453 | { | |
d19b6003 | 454 | /// Write TreeD here only |
d963c261 | 455 | |
d963c261 | 456 | char hname[30]; |
88cb7938 | 457 | // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent()); |
458 | fLoader->TreeD()->Write(hname,TObject::kOverwrite); | |
459 | fLoader->TreeD()->Reset(); | |
2ab0c725 | 460 | } |
a9e2aefa | 461 | |
d1775029 | 462 | //_____________________________________________________________________ |
463 | void AliMUON::Hits2SDigits() | |
464 | { | |
a3249004 | 465 | /// Perform Hits2Digits using SDigitizerV2 |
68585390 | 466 | |
7435e1f8 | 467 | AliMUONSDigitizerV2 sdigitizer; |
468 | sdigitizer.ExecuteTask(); | |
d1775029 | 469 | } |
68585390 | 470 | |
39e39255 | 471 | //_____________________________________________________________________ |
472 | void AliMUON::Digits2Raw() | |
473 | { | |
d19b6003 | 474 | /// Convert digits of the current event to raw data |
475 | ||
0014fbe8 | 476 | AliRawDataHeaderSim header; |
477 | ||
d5609cfc | 478 | if (!fRawWriter) |
479 | { | |
7435e1f8 | 480 | fRawWriter = new AliMUONRawWriter; |
481 | AliDebug(1,Form("Creating %s",fRawWriter->ClassName())); | |
d5609cfc | 482 | if (fTriggerScalerEvent == kTRUE) |
483 | { | |
84ceeb06 | 484 | fRawWriter->SetScalersNumbers(); |
d5609cfc | 485 | } |
486 | } | |
487 | ||
7435e1f8 | 488 | fLoader->LoadDigits("READ"); |
489 | ||
490 | TTree* treeD = fLoader->TreeD(); | |
491 | ||
492 | if (!treeD) | |
493 | { | |
494 | AliError("Could not get TreeD"); | |
495 | return; | |
496 | } | |
497 | ||
498 | AliMUONVTriggerStore* triggerStore = AliMUONVTriggerStore::Create(*treeD); | |
499 | AliMUONVDigitStore* digitStore = AliMUONVDigitStore::Create(*treeD); | |
500 | ||
501 | triggerStore->Connect(*treeD,kFALSE); | |
502 | digitStore->Connect(*treeD,kFALSE); | |
503 | ||
504 | treeD->GetEvent(0); | |
505 | ||
0014fbe8 | 506 | fRawWriter->SetHeader(header); |
7435e1f8 | 507 | if (!fRawWriter->Digits2Raw(digitStore,triggerStore)) |
d5609cfc | 508 | { |
509 | AliError("pb writting raw data"); | |
510 | } | |
7435e1f8 | 511 | |
512 | delete triggerStore; | |
513 | delete digitStore; | |
514 | ||
515 | fLoader->UnloadDigits(); | |
39e39255 | 516 | } |
68585390 | 517 | |
241560c2 | 518 | //_____________________________________________________________________ |
519 | Bool_t AliMUON::Raw2SDigits(AliRawReader* rawReader) | |
520 | { | |
5d950f54 | 521 | /// Convert raw data to SDigit |
ca8c8223 | 522 | |
241560c2 | 523 | if (!fLoader->TreeS()) fLoader->MakeSDigitsContainer(); |
ca8c8223 | 524 | |
7435e1f8 | 525 | TTree* treeS = fLoader->TreeS(); |
526 | ||
ca8c8223 | 527 | AliMUONVDigitStore* sDigitStore = AliMUONVDigitStore::Create(DigitStoreClassName()); |
c3305598 | 528 | AliMUONVTriggerStore* triggerStore = 0x0; |
529 | ||
7435e1f8 | 530 | sDigitStore->Connect(*treeS); |
c3305598 | 531 | |
ca8c8223 | 532 | if (!fDigitMaker) fDigitMaker = new AliMUONDigitMaker; |
c3305598 | 533 | |
534 | if (fConvertTrigger) { | |
535 | triggerStore = new AliMUONTriggerStoreV1; | |
536 | triggerStore->Connect(*treeS,true); | |
537 | fDigitMaker->SetMakeTriggerDigits(true); | |
538 | } | |
539 | ||
5d950f54 | 540 | if (!fDigitCalibrator) |
541 | { | |
542 | AliMUONRecoParam* recoParam = 0x0; | |
543 | ||
544 | AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam"); | |
545 | ||
546 | if (entry) | |
547 | { | |
548 | // load recoParam according OCDB content (single or array) | |
549 | if (!(recoParam = dynamic_cast<AliMUONRecoParam*>(entry->GetObject()))) | |
550 | { | |
551 | TObjArray* recoParamArray = static_cast<TObjArray*>(entry->GetObject()); | |
552 | ||
553 | for(Int_t i = 0; i < recoParamArray->GetEntriesFast(); ++i) | |
554 | { | |
555 | recoParam = static_cast<AliMUONRecoParam*>(recoParamArray->UncheckedAt(i)); | |
29464317 | 556 | if (recoParam && recoParam->IsDefault()) break; |
5d950f54 | 557 | recoParam = 0x0; |
558 | } | |
559 | } | |
560 | } | |
561 | ||
29464317 | 562 | if (!recoParam) |
563 | { | |
564 | AliFatal("Cannot work without recoparams !"); | |
565 | } | |
566 | ||
5d950f54 | 567 | TString calibMode = recoParam->GetCalibrationMode(); |
568 | ||
569 | fDigitCalibrator = new AliMUONDigitCalibrator(*fCalibrationData,recoParam,calibMode.Data()); | |
570 | } | |
571 | ||
c3305598 | 572 | fDigitMaker->Raw2Digits(rawReader,sDigitStore,triggerStore); |
5d950f54 | 573 | |
574 | fDigitCalibrator->Calibrate(*sDigitStore); | |
575 | ||
576 | TIter next(sDigitStore->CreateIterator()); | |
577 | AliMUONDigit* sdigit; | |
578 | ||
579 | // now tweak the digits to make them "as fresh as possible", i.e. | |
580 | // reset their calibrated status, as they'll be calibrated again | |
581 | // once embedded. | |
582 | while ( ( sdigit = static_cast<AliMUONDigit*>(next()) ) ) | |
583 | { | |
584 | sdigit->Calibrated(kFALSE); | |
5d950f54 | 585 | } |
586 | ||
7ead8580 | 587 | treeS->Fill(); |
5d950f54 | 588 | |
241560c2 | 589 | fLoader->WriteSDigits("OVERWRITE"); |
ca8c8223 | 590 | |
241560c2 | 591 | fLoader->UnloadSDigits(); |
ca8c8223 | 592 | |
7435e1f8 | 593 | delete sDigitStore; |
c3305598 | 594 | |
595 | delete triggerStore; | |
7435e1f8 | 596 | |
241560c2 | 597 | return kTRUE; |
241560c2 | 598 | } |
599 | ||
ce3f5e87 | 600 | //_______________________________________________________________________ |
3fa6cfdd | 601 | AliLoader* AliMUON::MakeLoader(const char* topfoldername) |
602 | { | |
d19b6003 | 603 | /// Build standard getter (AliLoader type); |
604 | /// if detector wants to use castomized getter, it must overload this method | |
8c343c7c | 605 | |
606 | AliDebug(1,Form("Creating standard getter for detector %s. Top folder is %s.", | |
607 | GetName(),topfoldername)); | |
128843d9 | 608 | fLoader = new AliLoader(GetName(),topfoldername); |
241560c2 | 609 | |
3fa6cfdd | 610 | return fLoader; |
611 | } | |
ffd9faa2 | 612 | |
d5609cfc | 613 | //________________________________________________________________________ |
614 | void | |
615 | AliMUON::ResetGeometryBuilder() | |
616 | { | |
d19b6003 | 617 | /// Only to be used by "experts" wanting to change the geometry builders |
618 | /// to be used. | |
619 | /// As the ctor of AliMUON now defines a default geometrybuilder, this | |
620 | /// ResetGeometryBuilder() must be called prior to call the | |
621 | /// AddGeometryBuilder() | |
622 | ||
d5609cfc | 623 | delete fGeometryBuilder; |
624 | fGeometryBuilder = new AliMUONGeometryBuilder(this); | |
625 | fGeometryBuilder | |
626 | ->AddBuilder(new AliMUONCommonGeometryBuilder(this)); | |
627 | } | |
44b96781 | 628 | |
629 | //____________________________________________________________________ | |
630 | Bool_t AliMUON::GetTriggerResponseV1() const | |
631 | { | |
632 | /// | |
633 | /// Returns fTriggerResponseV1 | |
634 | /// | |
635 | return fTriggerResponseV1; | |
636 | ||
637 | } | |
638 | ||
e93b11d0 | 639 | //____________________________________________________________________ |
640 | Int_t AliMUON::GetTriggerCoinc44() const | |
641 | { | |
642 | /// | |
643 | /// Returns fTriggerCoinc44 | |
644 | /// | |
645 | return fTriggerCoinc44; | |
646 | ||
afb3ccf0 | 647 | } |
648 | ||
649 | //____________________________________________________________________ | |
88570609 | 650 | Bool_t AliMUON::GetTriggerEffCells() const |
afb3ccf0 | 651 | { |
652 | /// | |
653 | /// Returns fTriggerEffCells | |
654 | /// | |
655 | return fTriggerEffCells; | |
656 | ||
e93b11d0 | 657 | } |
658 | ||
a3249004 | 659 | //____________________________________________________________________ |
8c0b5e70 | 660 | Int_t AliMUON::GetDigitizerWithNoise() const |
a3249004 | 661 | { |
662 | /// | |
663 | /// Returns fDigitizerWithNoise | |
664 | /// | |
665 | return fDigitizerWithNoise; | |
666 | ||
667 | } | |
668 | ||
b6c94614 | 669 |