]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUON.cxx
Remove obselete members & methods (Ch. Finck)
[u/mrichter/AliRoot.git] / MUON / AliMUON.cxx
CommitLineData
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
a9e2aefa 18
19///////////////////////////////////////////////
fe4da5cc 20// Manager and hits classes for set:MUON //
21////////////////////////////////////////////////
22
88cb7938 23#include "Riostream.h"
24
25#include <AliPDG.h>
a897a37a 26#include <TBRIK.h>
88cb7938 27#include <TCanvas.h>
28#include <TDirectory.h>
29#include <TFile.h>
94de3818 30#include <TGeometry.h>
88cb7938 31#include <TMinuit.h>
fe4da5cc 32#include <TNode.h>
88cb7938 33#include <TNtuple.h>
fe4da5cc 34#include <TObjArray.h>
88cb7938 35#include <TObject.h>
36#include <TObjectTable.h>
37#include <TPad.h>
a897a37a 38#include <TParticle.h>
39#include <TROOT.h>
88cb7938 40#include <TRandom.h>
41#include <TRotMatrix.h>
42#include <TTUBE.h>
a9e2aefa 43#include <TTUBE.h>
88cb7938 44#include <TTree.h>
45#include <TVector.h>
46#include <TVirtualMC.h>
fe4da5cc 47
d4bb94a1 48//#include "AliHeader.h"
88cb7938 49#include "AliLoader.h"
dbb4e169 50#include "AliRunDigitizer.h"
307d9d04 51#include "AliMC.h"
fac3a970 52#include "AliRun.h"
fe4da5cc 53#include "AliMUON.h"
88cb7938 54#include "AliMUONChamberTrigger.h"
88cb7938 55#include "AliMUONConstants.h"
ffd9faa2 56#include "AliMUONHit.h"
a9e2aefa 57#include "AliMUONRawCluster.h"
88cb7938 58#include "AliMUONTransientDigit.h"
ecfa008b 59#include "AliMUONTriggerCircuit.h"
d4bb94a1 60#include "AliMUONGeometryBuilder.h"
e118b27e 61#include "AliMUONCommonGeometryBuilder.h"
d1cd2474 62#include "AliMUONVGeometryBuilder.h"
e118b27e 63#include "AliMUONGeometryDEIndexing.h"
a713db22 64#include "AliMUONGeometrySegmentation.h"
dbb4e169 65#include "AliMUONDigitizerv2.h"
d1775029 66#include "AliMUONSDigitizerv1.h"
39e39255 67#include "AliMUONRawData.h"
002920d1 68#include "AliMUONFactoryV2.h"
8c343c7c 69#include "AliLog.h"
a9e2aefa 70
71// Defaults parameters for Z positions of chambers
72// taken from values for "stations" in AliMUON::AliMUON
73// const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.};
74// and from array "dstation" in AliMUONv1::CreateGeometry
75// Float_t dstation[5]={20., 20., 20, 20., 20.};
76// for tracking chambers,
77// according to (Z1 = zch - dstation) and (Z2 = zch + dstation)
78// for the first and second chambers in the station, respectively,
79// and from "DTPLANES" in AliMUONv1::CreateGeometry
80// const Float_t DTPLANES = 15.;
81// for trigger chambers,
82// according to (Z1 = zch) and (Z2 = zch + DTPLANES)
83// for the first and second chambers in the station, respectively
fe4da5cc 84
fe4da5cc 85ClassImp(AliMUON)
30178c30 86
ce3f5e87 87//__________________________________________________________________
fe4da5cc 88AliMUON::AliMUON()
30178c30 89 : AliDetector(),
90 fNCh(0),
91 fNTrackingCh(0),
92 fMUONData(0),
93 fSplitLevel(0),
94 fChambers(0),
30178c30 95 fTriggerCircuits(0),
d4bb94a1 96 fGeometryBuilder(0),
e118b27e 97 fDEIndexing(0),
30178c30 98 fAccCut(kFALSE),
99 fAccMin(0.),
100 fAccMax(0.),
101 fMaxStepGas(0.),
102 fMaxStepAlu(0.),
103 fMaxDestepGas(0.),
104 fMaxDestepAlu(0.),
105 fMaxIterPad(0),
106 fCurIterPad(0),
8109731a 107 fFactory(0)
fe4da5cc 108{
de05461e 109// Default Constructor
110//
1bd26093 111 fIshunt = 0;
fe4da5cc 112}
30178c30 113
ce3f5e87 114//__________________________________________________________________
fe4da5cc 115AliMUON::AliMUON(const char *name, const char *title)
30178c30 116 : AliDetector(name,title),
117 fNCh(AliMUONConstants::NCh()),
118 fNTrackingCh(AliMUONConstants::NTrackingCh()),
119 fMUONData(0),
120 fSplitLevel(0),
121 fChambers(0),
30178c30 122 fTriggerCircuits(0),
d4bb94a1 123 fGeometryBuilder(0),
e118b27e 124 fDEIndexing(0),
30178c30 125 fAccCut(kFALSE),
126 fAccMin(0.),
127 fAccMax(0.),
128 fMaxStepGas(0.1),
129 fMaxStepAlu(0.1),
130 fMaxDestepGas(-1), // Negatives values are ignored by geant3 CONS200
131 fMaxDestepAlu(-1), // in the calculation of the tracking parameters
132 fMaxIterPad(0),
133 fCurIterPad(0),
8109731a 134 fFactory(0)
fe4da5cc 135{
f665c1ea 136
30178c30 137 fIshunt = 0;
a897a37a 138
ce3f5e87 139 SetMarkerColor(kRed);//
e118b27e 140
141 // Geometry builder
142 fGeometryBuilder = new AliMUONGeometryBuilder(this);
143
144 // Common geometry definitions
145 fGeometryBuilder
146 ->AddBuilder(new AliMUONCommonGeometryBuilder(this));
147
148 // Define the global transformation:
149 // Transformation from the old ALICE coordinate system to a new one:
150 // x->-x, z->-z
151 TGeoRotation* rotGlobal
152 = new TGeoRotation("rotGlobal", 90., 180., 90., 90., 180., 0.);
153 fGeometryBuilder
154 ->SetGlobalTransformation (TGeoCombiTrans(0., 0., 0., rotGlobal));
155
156 // Detection elements indexing
157 fDEIndexing = new AliMUONGeometryDEIndexing();
158
a9e2aefa 159//
ce3f5e87 160// Creating List of Chambers
a9e2aefa 161 Int_t ch;
f665c1ea 162 fChambers = new TObjArray(AliMUONConstants::NCh());
d1cd2474 163
a9e2aefa 164 // Loop over stations
f665c1ea 165 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
a9e2aefa 166 // Loop over 2 chambers in the station
ce3f5e87 167 for (Int_t stCH = 0; stCH < 2; stCH++) {
168 //
169 //
170 // Default Parameters for Muon Tracking Stations
171 ch = 2 * st + stCH;
172 if (ch < AliMUONConstants::NTrackingCh()) {
173 fChambers->AddAt(new AliMUONChamber(ch),ch);
174 } else {
175 fChambers->AddAt(new AliMUONChamberTrigger(ch),ch);
176 }
177 AliMUONChamber* chamber = (AliMUONChamber*) fChambers->At(ch);
d1cd2474 178 //chamber->SetGid(0);
ce3f5e87 179 // Default values for Z of chambers
180 chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
181 //
182 chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch));
183 // Set chamber inner and outer radius to default
f4a7360f 184 chamber->SetRInner(AliMUONConstants::Dmin(st)/2.);
185 chamber->SetROuter(AliMUONConstants::Dmax(st)/2.);
ce3f5e87 186 //
187 } // Chamber stCH (0, 1) in
a9e2aefa 188 } // Station st (0...)
ce3f5e87 189
ce3f5e87 190 // cp new design of AliMUONTriggerDecision
191 fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
192 for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
193 fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ);
194 }
fe4da5cc 195}
30178c30 196
ce3f5e87 197//____________________________________________________________________
30178c30 198AliMUON::AliMUON(const AliMUON& rMUON)
199 : AliDetector(rMUON)
a9e2aefa 200{
30178c30 201// Protected copy constructor
202
8c343c7c 203 AliFatal("Not implemented.");
a9e2aefa 204}
30178c30 205
ce3f5e87 206//____________________________________________________________________
fe4da5cc 207AliMUON::~AliMUON()
208{
de05461e 209// Destructor
8c343c7c 210 AliDebug(1,"Calling AliMUON destructor");
ce3f5e87 211 fIshunt = 0;
d1cd2474 212
c6df4ef2 213 if (fChambers){
214 fChambers->Delete();
215 delete fChambers;
216 }
217 if (fTriggerCircuits){
218 fTriggerCircuits->Delete();
219 delete fTriggerCircuits;
220 }
221 delete fMUONData;
d4bb94a1 222 delete fGeometryBuilder;
e118b27e 223 delete fDEIndexing;
8109731a 224 delete fFactory;
d1cd2474 225}
30178c30 226
227//________________________________________________________________________
228AliMUON& AliMUON::operator = (const AliMUON& rhs)
229{
230// Protected assignement operator
231
232 if (this == &rhs) return *this;
233
8c343c7c 234 AliFatal("Not implemented.");
30178c30 235
236 return *this;
237}
238
d1cd2474 239//_____________________________________________________________________________
240void AliMUON::AddGeometryBuilder(AliMUONVGeometryBuilder* geomBuilder)
241{
242// Adds the geometry builder to the list
243// ---
244
d4bb94a1 245 fGeometryBuilder->AddBuilder(geomBuilder);
a897a37a 246}
c9d10ab5 247
ce3f5e87 248//____________________________________________________________________
fe4da5cc 249void AliMUON::BuildGeometry()
250{
de05461e 251// Geometry for event display
c9d10ab5 252
002920d1 253
ae89d471 254// for (Int_t i = 0; i < AliMUONConstants::NCh(); i++)
255// this->Chamber(i).SegmentationModel2(1)->Draw("eventdisplay");// to be check !
256
002920d1 257
fe4da5cc 258}
c9d10ab5 259
ce3f5e87 260//__________________________________________________________________
261void AliMUON::SetTreeAddress()
a897a37a 262{
ce3f5e87 263 GetMUONData()->SetLoader(fLoader);
d1775029 264 // GetMUONData()->MakeBranch("D,S,RC");
265 // GetMUONData()->SetTreeAddress("H,D,S,RC");
52c9bc11 266 GetMUONData()->SetTreeAddress("H");
307d9d04 267 if (fHits != GetMUONData()->Hits()) {
ae31c826 268 if ( gAlice->GetMCApp() )
6d2f7cbd 269 if ( gAlice->GetMCApp()->GetHitLists() ) {
270 fHits = GetMUONData()->Hits();
271 gAlice->GetMCApp()->AddHitList(fHits); // For purifyKine, only necessary when Hit list is created in AliMUONData
272 }
307d9d04 273 }
6d2f7cbd 274 fHits = GetMUONData()->Hits(); // Added by Ivana to use the methods FisrtHit, NextHit of AliDetector
a9e2aefa 275}
276
fe4da5cc 277//___________________________________________
a9e2aefa 278void AliMUON::SetChambersZ(const Float_t *Z)
279{
280 // Set Z values for all chambers (tracking and trigger)
281 // from the array pointed to by "Z"
f665c1ea 282 for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++)
2682e810 283 ((AliMUONChamber*) fChambers->At(ch))->SetZ(Z[ch]);
f665c1ea 284 return;
a9e2aefa 285}
ce3f5e87 286//_________________________________________________________________
a9e2aefa 287void AliMUON::SetChambersZToDefault()
fe4da5cc 288{
a9e2aefa 289 // Set Z values for all chambers (tracking and trigger)
290 // to default values
f665c1ea 291 SetChambersZ(AliMUONConstants::DefaultChamberZ());
a9e2aefa 292 return;
fe4da5cc 293}
ce3f5e87 294//_________________________________________________________________
a897a37a 295void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
fe4da5cc 296{
de05461e 297// Set the inverse charge slope for chamber id
ce3f5e87 298 Int_t i=2*(id-1); //PH ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1);
299 //PH ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1);
2682e810 300 ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1);
301 ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1);
fe4da5cc 302}
ce3f5e87 303//__________________________________________________________________
a897a37a 304void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
fe4da5cc 305{
de05461e 306// Set sigma of charge spread for chamber id
fe4da5cc 307 Int_t i=2*(id-1);
2682e810 308 ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2);
309 ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2);
fe4da5cc 310}
ce3f5e87 311//___________________________________________________________________
a897a37a 312void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
fe4da5cc 313{
de05461e 314// Set integration limits for charge spread
fe4da5cc 315 Int_t i=2*(id-1);
2682e810 316 ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1);
317 ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1);
fe4da5cc 318}
319
ce3f5e87 320//__________________________________________________________________
d09fafb0 321void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
fe4da5cc 322{
de05461e 323// Set maximum number for ADCcounts (saturation)
fe4da5cc 324 Int_t i=2*(id-1);
2682e810 325 ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1);
326 ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1);
fe4da5cc 327}
d4bb94a1 328
ce3f5e87 329//__________________________________________________________________
a897a37a 330void AliMUON::SetMaxStepGas(Float_t p1)
fe4da5cc 331{
de05461e 332// Set stepsize in gas
ce3f5e87 333 fMaxStepGas=p1;
fe4da5cc 334}
ce3f5e87 335//__________________________________________________________________
a897a37a 336void AliMUON::SetMaxStepAlu(Float_t p1)
fe4da5cc 337{
de05461e 338// Set step size in Alu
fe4da5cc 339 fMaxStepAlu=p1;
340}
ce3f5e87 341//__________________________________________________________________
a897a37a 342void AliMUON::SetMaxDestepGas(Float_t p1)
fe4da5cc 343{
de05461e 344// Set maximum step size in Gas
fe4da5cc 345 fMaxDestepGas=p1;
346}
ce3f5e87 347//__________________________________________________________________
a897a37a 348void AliMUON::SetMaxDestepAlu(Float_t p1)
fe4da5cc 349{
de05461e 350// Set maximum step size in Alu
ce3f5e87 351 fMaxDestepAlu=p1;
fe4da5cc 352}
d4bb94a1 353
d1cd2474 354//____________________________________________________________________
355Float_t AliMUON::GetMaxStepGas() const
356{
357// Return stepsize in gas
358
359 return fMaxStepGas;
360}
361
362//____________________________________________________________________
363Float_t AliMUON::GetMaxStepAlu() const
364{
365// Return step size in Alu
366
367 return fMaxStepAlu;
368}
369
370//____________________________________________________________________
371Float_t AliMUON::GetMaxDestepGas() const
372{
373// Return maximum step size in Gas
374
375 return fMaxDestepGas;
376}
377
378//____________________________________________________________________
379Float_t AliMUON::GetMaxDestepAlu() const
380{
381// Return maximum step size in Gas
382
383 return fMaxDestepAlu;
384}
d4bb94a1 385
883746f3 386//____________________________________________________________________
387 void AliMUON::SetAlign(Bool_t align)
a713db22 388{
883746f3 389 // Sets option for alignement to geometry builder
390
391 fGeometryBuilder->SetAlign(align);
392}
393
a713db22 394//____________________________________________________________________
395void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliMUONGeometrySegmentation* segmentation)
396{
de05461e 397// Set the segmentation for chamber id cathode isec
2682e810 398 ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation);
fe4da5cc 399
400}
ce3f5e87 401//____________________________________________________________________
a9e2aefa 402void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
fe4da5cc 403{
de05461e 404// Set the response for chamber id
2682e810 405 ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response);
fe4da5cc 406}
ce3f5e87 407//____________________________________________________________________
fe4da5cc 408void AliMUON::SetNsec(Int_t id, Int_t nsec)
409{
de05461e 410// Set number of segmented cathods for chamber id
2682e810 411 ((AliMUONChamber*) fChambers->At(id))->SetNsec(nsec);
fe4da5cc 412}
85a5290f 413//____________________________________________________________________
c92eb8ad 414AliDigitizer* AliMUON::CreateDigitizer(AliRunDigitizer* manager) const
85a5290f 415{
dbb4e169 416 return new AliMUONDigitizerv2(manager);
85a5290f 417}
ce3f5e87 418//_____________________________________________________________________
2ab0c725 419void AliMUON::SDigits2Digits()
420{
d963c261 421
422// write TreeD here
423
d963c261 424 char hname[30];
88cb7938 425 // sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent());
426 fLoader->TreeD()->Write(hname,TObject::kOverwrite);
427 fLoader->TreeD()->Reset();
2ab0c725 428}
a9e2aefa 429
d1775029 430//_____________________________________________________________________
431void AliMUON::Hits2SDigits()
432{
dbb4e169 433 // Adaption of AliMUONSDigitizerv1 to be excuted by the AliSimulation framework
434 AliRunLoader* runLoader = fLoader->GetRunLoader();
435 AliRunDigitizer * manager = new AliRunDigitizer(1,1);
e191bb57 436 manager->SetInputStream(0,runLoader->GetFileName(),AliConfig::GetDefaultEventFolderName());
dbb4e169 437 AliMUONDigitizer * dMUON = new AliMUONSDigitizerv1(manager);
438 fLoader->LoadHits("READ");
439 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
440 runLoader->GetEvent(iEvent);
441 dMUON->Exec("");
442 }
443 fLoader->UnloadHits();
d1775029 444}
39e39255 445//_____________________________________________________________________
446void AliMUON::Digits2Raw()
447{
448 // convert digits of the current event to raw data
449 AliMUONRawData* rawData;
450
451 rawData = new AliMUONRawData(fLoader);
1197ff51 452 if (!rawData->Digits2Raw()) AliInfo("pb writting raw data");
39e39255 453 delete rawData;
454 return;
455}
ce3f5e87 456//_______________________________________________________________________
3fa6cfdd 457AliLoader* AliMUON::MakeLoader(const char* topfoldername)
458{
459//builds standard getter (AliLoader type)
460//if detector wants to use castomized getter, it must overload this method
461
8c343c7c 462
463 AliDebug(1,Form("Creating standard getter for detector %s. Top folder is %s.",
464 GetName(),topfoldername));
128843d9 465 fLoader = new AliLoader(GetName(),topfoldername);
ce3f5e87 466 fMUONData = new AliMUONData(fLoader,GetName(),GetName());
d652f85c 467 fMUONData->SetSplitLevel(fSplitLevel);
3fa6cfdd 468 return fLoader;
469}
ce3f5e87 470//_______________________________________________________________________
a897a37a 471
472AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
473{
de05461e 474//
475// Return rawcluster (icluster) for chamber ichamber and cathode icathod
476// Obsolete ??
ce3f5e87 477 TClonesArray *muonRawCluster = GetMUONData()->RawClusters(ichamber);
a897a37a 478 ResetRawClusters();
88cb7938 479 TTree *treeR = fLoader->TreeR();
a9e2aefa 480 Int_t nent=(Int_t)treeR->GetEntries();
481 treeR->GetEvent(nent-2+icathod-1);
482 //treeR->GetEvent(icathod);
483 //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
a897a37a 484
a9e2aefa 485 AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
a897a37a 486 //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
487
488 return mRaw;
489}
ce3f5e87 490//________________________________________________________________________
ffd9faa2 491