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),
80 fNTPCRef(0), // tpc references counter
81 fNITSRef(0), // ITS references counter
82 fNTRDRef(0), // TRD references counter
83 fNTOFRef(0), // TOF references counter
90 // Default constructor
92 fTPCReferences = new TClonesArray("AliTrackReference",10);
93 fITSReferences = new TClonesArray("AliTrackReference",10);
94 fTRDReferences = new TClonesArray("AliTrackReference",10);
95 fTOFReferences = new TClonesArray("AliTrackReference",10);
96 fTRdecay.SetTrack(-1);
100 AliMCInfo::AliMCInfo(const AliMCInfo& info):
102 fTrackRef(info.fTrackRef),
103 fTrackRefOut(info.fTrackRefOut),
104 fTRdecay(info.GetTRdecay()),
105 fPrimPart(info.fPrimPart),
106 fParticle(info.fParticle),
107 fMass(info.GetMass()),
108 fCharge(info.fCharge),
110 fEventNr(info.fEventNr),
111 fMCtracks(info.fMCtracks),
113 fTPCdecay(info.fTPCdecay),
114 fRowsWithDigitsInn(info.fRowsWithDigitsInn),
115 fRowsWithDigits(info.fRowsWithDigits),
116 fRowsTrackLength(info.fRowsTrackLength),
118 fTPCRow(info.fTPCRow),
119 fNTPCRef(info.fNTPCRef), // tpc references counter
120 fNITSRef(info.fNITSRef), // ITS references counter
121 fNTRDRef(info.fNTRDRef), // TRD references counter
122 fNTOFRef(info.fNTOFRef), // TOF references counter
131 fTPCReferences = (TClonesArray*)info.fTPCReferences->Clone();
132 fITSReferences = (TClonesArray*)info.fITSReferences->Clone();
133 fTRDReferences = (TClonesArray*)info.fTRDReferences->Clone();
134 fTOFReferences = (TClonesArray*)info.fTOFReferences->Clone();
138 AliMCInfo::~AliMCInfo()
141 // Destructor of the class
143 if (fTPCReferences) {
144 delete fTPCReferences;
147 delete fITSReferences;
150 delete fTRDReferences;
153 delete fTOFReferences;
160 void AliMCInfo::Update()
164 // Calculates some derived variables
168 if (!fTPCReferences) {
174 fNTPCRef = fTPCReferences->GetEntriesFast();
175 fNITSRef = fITSReferences->GetEntriesFast();
176 fNTRDRef = fTRDReferences->GetEntriesFast();
177 fNTOFRef = fTOFReferences->GetEntriesFast();
179 for (Int_t iref =0;iref<fTPCReferences->GetEntriesFast();iref++){
180 AliTrackReference * ref = (AliTrackReference *) fTPCReferences->At(iref);
181 //Float_t r = (ref->X()*ref->X()+ref->Y()*ref->Y());
182 Float_t newdirection = ref->X()*ref->Px()+ref->Y()*ref->Py(); //inside or outside
183 if (iref==0) direction = newdirection;
184 if ( newdirection*direction<0){
186 direction = newdirection;
194 if (fTRdecay.GetTrack()>0){
195 fDecayCoord[0] = fTRdecay.X();
196 fDecayCoord[1] = fTRdecay.Y();
197 fDecayCoord[2] = fTRdecay.Z();
198 if ( (fTRdecay.R()<250)&&(fTRdecay.R()>85) && (TMath::Abs(fTRdecay.Z())<250) ){
209 //digits information update
210 fRowsWithDigits = fTPCRow.RowsOn();
211 fRowsWithDigitsInn = fTPCRow.RowsOn(63); // 63 = number of inner rows
212 fRowsTrackLength = fTPCRow.Last() - fTPCRow.First();
215 // calculate primary ionization per cm
216 if (fParticle.GetPDG()){
217 fMass = fParticle.GetMass();
218 fCharge = fParticle.GetPDG()->Charge();
219 if (fTPCReferences->GetEntriesFast()>0){
220 fTrackRef = *((AliTrackReference*)fTPCReferences->At(0));
223 Float_t p = TMath::Sqrt(fTrackRef.Px()*fTrackRef.Px()+
224 fTrackRef.Py()*fTrackRef.Py()+
225 fTrackRef.Pz()*fTrackRef.Pz());
227 Float_t betagama = p /fMass;
228 fPrim = TPCBetheBloch(betagama);
240 ////////////////////////////////////////////////////////////////////////
241 AliTPCdigitRow::AliTPCdigitRow()
245 ////////////////////////////////////////////////////////////////////////
246 AliTPCdigitRow & AliTPCdigitRow::operator=(const AliTPCdigitRow &digOld)
248 for (Int_t i = 0; i<32; i++) fDig[i] = digOld.fDig[i];
251 ////////////////////////////////////////////////////////////////////////
252 void AliTPCdigitRow::SetRow(Int_t row)
255 // set bit mask for given row
258 // cerr<<"AliTPCdigitRow::SetRow: index "<<row<<" out of bounds."<<endl;
266 ////////////////////////////////////////////////////////////////////////
267 Bool_t AliTPCdigitRow::TestRow(Int_t row) const
270 // return kTRUE if row is on
274 return TESTBIT(fDig[iC],iB);
276 ////////////////////////////////////////////////////////////////////////
277 Int_t AliTPCdigitRow::RowsOn(Int_t upto) const
280 // returns number of rows with a digit
281 // count only rows less equal row number upto
284 for (Int_t i = 0; i<32; i++) {
285 for (Int_t j = 0; j < 8; j++) {
286 if (i*8+j > upto) return total;
287 if (TESTBIT(fDig[i],j)) total++;
292 ////////////////////////////////////////////////////////////////////////
293 void AliTPCdigitRow::Reset()
296 // resets all rows to zero
298 for (Int_t i = 0; i<32; i++) {
302 ////////////////////////////////////////////////////////////////////////
303 Int_t AliTPCdigitRow::Last() const
306 // returns the last row number with a digit
307 // returns -1 if now digits
309 for (Int_t i = 32-1; i>=0; i--) {
310 for (Int_t j = 7; j >= 0; j--) {
311 if TESTBIT(fDig[i],j) return i*8+j;
316 ////////////////////////////////////////////////////////////////////////
317 Int_t AliTPCdigitRow::First() const
320 // returns the first row number with a digit
321 // returns -1 if now digits
323 for (Int_t i = 0; i<32; i++) {
324 for (Int_t j = 0; j < 8; j++) {
325 if (TESTBIT(fDig[i],j)) return i*8+j;
332 //_____________________________________________________________________________
333 Float_t AliMCInfo::TPCBetheBloch(Float_t bg)
336 // Bethe-Bloch energy loss formula
338 const Double_t kp1=0.76176e-1;
339 const Double_t kp2=10.632;
340 const Double_t kp3=0.13279e-4;
341 const Double_t kp4=1.8631;
342 const Double_t kp5=1.9479;
344 Double_t dbg = (Double_t) bg;
346 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
348 Double_t aa = TMath::Power(beta,kp4);
349 Double_t bb = TMath::Power(1./dbg,kp5);
351 bb=TMath::Log(kp3+bb);
353 return ((Float_t)((kp2-aa-bb)*kp1/aa));