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