1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////
20 Origin: marian.ivanov@cern.ch
21 Container classes with MC infomation
23 The AliMCInfo contains the information about the particles properties
24 during transportation throuch ALICE Detector
26 The base Information :
27 TParticle - fParticle - properties of the particle at creation point
28 AliTrackReference - fXXXRefernces - TClonesArray of refernces in differnt detectors
29 fNXXXRef - number of the track refernces in differnt detectors
30 AliTPCdigitRow - fTPCRow - the map of the hitted rows - (will be repalced by TBits)
31 fRowsWith* - number of rows hitted by particle
32 fMCtracks - - number of turn over of the track inside of the TPC
35 some additional information usable for tree draw - TO SPEED UP tree queries
36 IMPORTANT FOR PROOF FAST PROTOTYPING ANALYSIS
43 #if !defined(__CINT__) || defined(__MAKECINT__)
47 #include "TClonesArray.h"
49 #include "AliTrackReference.h"
50 #include "AliMCInfo.h"
56 ClassImp(AliTPCdigitRow)
61 ////////////////////////////////////////////////////////////////////////
62 AliMCInfo::AliMCInfo():
75 fRowsWithDigitsInn(0),
81 fNTPCRef(0), // tpc references counter
82 fNITSRef(0), // ITS references counter
83 fNTRDRef(0), // TRD references counter
84 fNTOFRef(0), // TOF references counter
91 // Default constructor
93 fTPCReferences = new TClonesArray("AliTrackReference",10);
94 fITSReferences = new TClonesArray("AliTrackReference",10);
95 fTRDReferences = new TClonesArray("AliTrackReference",10);
96 fTOFReferences = new TClonesArray("AliTrackReference",10);
97 fTRdecay.SetTrack(-1);
101 AliMCInfo::AliMCInfo(const AliMCInfo& info):
103 fTrackRef(info.fTrackRef),
104 fTrackRefOut(info.fTrackRefOut),
105 fTRdecay(info.GetTRdecay()),
106 fPrimPart(info.fPrimPart),
107 fParticle(info.fParticle),
108 fMass(info.GetMass()),
109 fCharge(info.fCharge),
111 fEventNr(info.fEventNr),
112 fMCtracks(info.fMCtracks),
114 fTPCdecay(info.fTPCdecay),
115 fRowsWithDigitsInn(info.fRowsWithDigitsInn),
116 fRowsWithDigits(info.fRowsWithDigits),
117 fRowsTrackLength(info.fRowsTrackLength),
118 fTPCtrackLength(info.fTPCtrackLength),
120 fTPCRow(info.fTPCRow),
121 fNTPCRef(info.fNTPCRef), // tpc references counter
122 fNITSRef(info.fNITSRef), // ITS references counter
123 fNTRDRef(info.fNTRDRef), // TRD references counter
124 fNTOFRef(info.fNTOFRef), // TOF references counter
133 fTPCReferences = (TClonesArray*)info.fTPCReferences->Clone();
134 fITSReferences = (TClonesArray*)info.fITSReferences->Clone();
135 fTRDReferences = (TClonesArray*)info.fTRDReferences->Clone();
136 fTOFReferences = (TClonesArray*)info.fTOFReferences->Clone();
140 AliMCInfo::~AliMCInfo()
143 // Destructor of the class
145 if (fTPCReferences) {
146 delete fTPCReferences;
149 delete fITSReferences;
152 delete fTRDReferences;
155 delete fTOFReferences;
162 void AliMCInfo::Update()
166 // Calculates some derived variables
173 if (fTRdecay.GetTrack()>0){
174 fDecayCoord[0] = fTRdecay.X();
175 fDecayCoord[1] = fTRdecay.Y();
176 fDecayCoord[2] = fTRdecay.Z();
177 if ( (fTRdecay.R()<250)&&(fTRdecay.R()>85) && (TMath::Abs(fTRdecay.Z())<250) ){
188 //digits information update
189 fRowsWithDigits = fTPCRow.RowsOn();
190 fRowsWithDigitsInn = fTPCRow.RowsOn(63); // 63 = number of inner rows
191 fRowsTrackLength = fTPCRow.Last() - fTPCRow.First();
194 // calculate primary ionization per cm
195 if (fParticle.GetPDG()){
196 fMass = fParticle.GetMass();
197 fCharge = fParticle.GetPDG()->Charge();
198 if (fTPCReferences->GetEntriesFast()>0){
199 fTrackRef = *((AliTrackReference*)fTPCReferences->At(0));
202 Float_t p = TMath::Sqrt(fTrackRef.Px()*fTrackRef.Px()+
203 fTrackRef.Py()*fTrackRef.Py()+
204 fTrackRef.Pz()*fTrackRef.Pz());
206 Float_t betagama = p /fMass;
207 fPrim = TPCBetheBloch(betagama);
219 ////////////////////////////////////////////////////////////////////////
220 AliTPCdigitRow::AliTPCdigitRow()
224 ////////////////////////////////////////////////////////////////////////
225 AliTPCdigitRow & AliTPCdigitRow::operator=(const AliTPCdigitRow &digOld)
227 for (Int_t i = 0; i<32; i++) fDig[i] = digOld.fDig[i];
230 ////////////////////////////////////////////////////////////////////////
231 void AliTPCdigitRow::SetRow(Int_t row)
234 // set bit mask for given row
237 // cerr<<"AliTPCdigitRow::SetRow: index "<<row<<" out of bounds."<<endl;
245 ////////////////////////////////////////////////////////////////////////
246 Bool_t AliTPCdigitRow::TestRow(Int_t row) const
249 // return kTRUE if row is on
253 return TESTBIT(fDig[iC],iB);
255 ////////////////////////////////////////////////////////////////////////
256 Int_t AliTPCdigitRow::RowsOn(Int_t upto) const
259 // returns number of rows with a digit
260 // count only rows less equal row number upto
263 for (Int_t i = 0; i<32; i++) {
264 for (Int_t j = 0; j < 8; j++) {
265 if (i*8+j > upto) return total;
266 if (TESTBIT(fDig[i],j)) total++;
271 ////////////////////////////////////////////////////////////////////////
272 void AliTPCdigitRow::Reset()
275 // resets all rows to zero
277 for (Int_t i = 0; i<32; i++) {
281 ////////////////////////////////////////////////////////////////////////
282 Int_t AliTPCdigitRow::Last() const
285 // returns the last row number with a digit
286 // returns -1 if now digits
288 for (Int_t i = 32-1; i>=0; i--) {
289 for (Int_t j = 7; j >= 0; j--) {
290 if TESTBIT(fDig[i],j) return i*8+j;
295 ////////////////////////////////////////////////////////////////////////
296 Int_t AliTPCdigitRow::First() const
299 // returns the first row number with a digit
300 // returns -1 if now digits
302 for (Int_t i = 0; i<32; i++) {
303 for (Int_t j = 0; j < 8; j++) {
304 if (TESTBIT(fDig[i],j)) return i*8+j;
311 //_____________________________________________________________________________
312 Float_t AliMCInfo::TPCBetheBloch(Float_t bg)
315 // Bethe-Bloch energy loss formula
317 const Double_t kp1=0.76176e-1;
318 const Double_t kp2=10.632;
319 const Double_t kp3=0.13279e-4;
320 const Double_t kp4=1.8631;
321 const Double_t kp5=1.9479;
323 Double_t dbg = (Double_t) bg;
325 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
327 Double_t aa = TMath::Power(beta,kp4);
328 Double_t bb = TMath::Power(1./dbg,kp5);
330 bb=TMath::Log(kp3+bb);
332 return ((Float_t)((kp2-aa-bb)*kp1/aa));
336 void AliMCInfo::CalcTPCrows(TClonesArray * runArrayTR){
338 // Calculates the numebr of the track references for detectors
339 // In case of changing direction - curling tracks - the counter is not increasing
342 // of the first and last point in the TPC
348 Float_t tpcminRadius=250;
349 Float_t tpcmaxRadius=80;
353 for (Int_t iTrackRef = 0; iTrackRef < runArrayTR->GetEntriesFast(); iTrackRef++) {
355 AliTrackReference *ref = (AliTrackReference*)runArrayTR->At(iTrackRef);
356 Float_t newdirection = (ref->X()*ref->Px()+ref->Y()*ref->Py()>0)? 1.:-1.; //inside or outside
357 if (dir*newdirection<0.5) {
362 if (ref->DetectorId()== AliTrackReference::kTRD){
366 if (ref->DetectorId()== AliTrackReference::kITS){
370 if (ref->DetectorId()== AliTrackReference::kITS){
375 if (ref->DetectorId()== AliTrackReference::kTPC){
377 if (ref->R()>tpcmaxRadius) tpcmaxRadius = ref->R();
378 if (ref->R()<tpcminRadius) tpcminRadius = ref->R();
380 if (ref->DetectorId()== AliTrackReference::kDisappeared){
381 if (TMath::Abs(ref->Z())<250 && TMath::Abs(ref->R()<250))
382 tpcmaxRadius = ref->R();
385 fTPCtrackLength = tpcmaxRadius-tpcminRadius;