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 **************************************************************************/
16 //_________________________________________________________________________
17 // This is a TTask that constructs SDigits out of Hits
18 // A Summable Digits is the sum of all hits in a cell
19 // A threshold is applied
21 //-- Author: Alla Maevskaia(INR)
22 //////////////////////////////////////////////////////////////////////////////
24 // --- ROOT system ---
29 // --- Standard library ---
31 // --- AliRoot header files ---
33 #include "AliFMDdigit.h"
34 #include "AliFMDhit.h"
37 #include "AliFMDSDigitizer.h"
39 #include "AliDetector.h"
48 #include <Riostream.h>
50 ClassImp(AliFMDSDigitizer)
52 //____________________________________________________________________________
53 AliFMDSDigitizer::AliFMDSDigitizer():TTask("AliFMDSDigitizer","")
62 //____________________________________________________________________________
63 AliFMDSDigitizer::AliFMDSDigitizer(char* HeaderFile,char *SdigitsFile ):TTask("AliFMDSDigitizer","")
65 fNevents = 0 ; // Number of events to digitize, 0 means all evens in current file
66 // add Task to //root/Tasks folder
67 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
68 roottasks->Add(this) ;
71 //____________________________________________________________________________
72 AliFMDSDigitizer::~AliFMDSDigitizer()
77 //---------------------------------------------------------------------
78 void AliFMDSDigitizer::SetRingsSi1(Int_t ringsSi1)
82 void AliFMDSDigitizer::SetSectorsSi1(Int_t sectorsSi1)
84 fSectorsSi1=sectorsSi1;
86 void AliFMDSDigitizer::SetRingsSi2(Int_t ringsSi2)
90 void AliFMDSDigitizer::SetSectorsSi2(Int_t sectorsSi2)
92 fSectorsSi2=sectorsSi2;
95 //____________________________________________________________________________
96 void AliFMDSDigitizer::Exec(Option_t *option) {
101 Int_t NumberOfRings[5]=
102 {fRingsSi1,fRingsSi2,fRingsSi1,fRingsSi2,fRingsSi1};
103 Int_t NumberOfSectors[5]=
104 {fSectorsSi1,fSectorsSi2,fSectorsSi1,fSectorsSi2,fSectorsSi1};
106 // Initialise Hit array
107 fHits = new TClonesArray ("AliFMDhit", 1000);
108 fSDigits = new TClonesArray ("AliFMDdigit", 1000);
110 AliFMD *FMD = (AliFMD *) gAlice->GetDetector ("FMD");
113 fNevents = (Int_t) gAlice->TreeE ()->GetEntries ();
115 for (Int_t ievent = 0; ievent < fNevents; ievent++)
117 gAlice->GetEvent (ievent);
118 if (gAlice->TreeH () == 0)
120 if (gAlice->TreeS () == 0)
121 gAlice->MakeTree ("S");
128 sprintf (branchname, "%s", FMD->GetName ());
129 //Make branch for digits
130 FMD->MakeBranch ("S");
132 //Now made SDigits from hits, for PHOS it is the same
133 Int_t volume, sector, ring, charge;
135 Float_t de[10][50][150];
136 Int_t ivol, isec, iring;
140 TClonesArray *FMDhits = FMD->Hits ();
142 // Event ------------------------- LOOP
144 for (ivol = 0; ivol < 10; ivol++)
145 for (isec = 0; isec < 50; isec++)
146 for (iring = 0; iring < 150; iring++)
147 de[ivol][isec][iring] = 0;
151 FMDhits = FMD->Hits ();
152 TTree *TH = gAlice->TreeH ();
153 Stat_t ntracks = TH->GetEntries ();
154 for (Int_t track = 0; track < ntracks; track++)
156 gAlice->ResetHits ();
157 nbytes += TH->GetEvent (track);
158 particle = gAlice->Particle (track);
159 Int_t nhits = FMDhits->GetEntriesFast ();
161 for (hit = 0; hit < nhits; hit++)
163 fmdHit = (AliFMDhit *) FMDhits->UncheckedAt (hit);
165 volume = fmdHit->Volume ();
166 sector = fmdHit->NumberOfSector ();
167 ring = fmdHit->NumberOfRing ();
169 de[volume][sector][ring] += e;
176 Float_t I = 1.664 * 0.04 * 2.33 / 22400; // = 0.69e-6;
177 for (ivol = 1; ivol < 6; ivol++)
179 for (isec = 1; isec <= NumberOfSectors[ivol-1]; isec++)
181 for (iring = 1; iring <= NumberOfRings[ivol-1]; iring++)
186 charge = Int_t (de[ivol][isec][iring] / I);
189 //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV)
191 Float_t channelWidth = (22400 * 30) / 1024;
193 digit[4] = Int_t (digit[3] / channelWidth);
194 FMD->AddSDigit(digit);
200 gAlice->TreeS()->Reset();
201 gAlice->TreeS()->Fill();
202 gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
208 //__________________________________________________________________
209 void AliFMDSDigitizer::SetSDigitsFile(char * file ){
210 if(!fSDigitsFile.IsNull())
211 cout << "Changing SDigits file from " <<(char *)fSDigitsFile.Data() << " to " << file << endl ;
214 //__________________________________________________________________
215 void AliFMDSDigitizer::Print(Option_t* option)const
217 cout << "------------------- "<< GetName() << " -------------" << endl ;
218 if(fSDigitsFile.IsNull())
219 cout << " Writing SDigitis to file galice.root "<< endl ;
221 cout << " Writing SDigitis to file " << (char*) fSDigitsFile.Data() << endl ;