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"
52 ClassImp(AliFMDSDigitizer)
54 //____________________________________________________________________________
55 AliFMDSDigitizer::AliFMDSDigitizer():TTask("AliFMDSDigitizer","")
64 //____________________________________________________________________________
65 AliFMDSDigitizer::AliFMDSDigitizer(char* HeaderFile,char *SdigitsFile ):TTask("AliFMDSDigitizer","")
67 fNevents = 0 ; // Number of events to digitize, 0 means all evens in current file
68 // add Task to //root/Tasks folder
69 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
70 roottasks->Add(this) ;
73 //____________________________________________________________________________
74 AliFMDSDigitizer::~AliFMDSDigitizer()
79 //---------------------------------------------------------------------
80 void AliFMDSDigitizer::SetRingsSi1(Int_t ringsSi1)
84 void AliFMDSDigitizer::SetSectorsSi1(Int_t sectorsSi1)
86 fSectorsSi1=sectorsSi1;
88 void AliFMDSDigitizer::SetRingsSi2(Int_t ringsSi2)
92 void AliFMDSDigitizer::SetSectorsSi2(Int_t sectorsSi2)
94 fSectorsSi2=sectorsSi2;
97 //____________________________________________________________________________
98 void AliFMDSDigitizer::Exec(Option_t *option) {
103 Int_t NumberOfRings[5]=
104 {fRingsSi1,fRingsSi2,fRingsSi1,fRingsSi2,fRingsSi1};
105 Int_t NumberOfSectors[5]=
106 {fSectorsSi1,fSectorsSi2,fSectorsSi1,fSectorsSi2,fSectorsSi1};
108 // Initialise Hit array
109 fHits = new TClonesArray ("AliFMDhit", 1000);
110 fSDigits = new TClonesArray ("AliFMDdigit", 1000);
112 AliFMD *FMD = (AliFMD *) gAlice->GetDetector ("FMD");
115 fNevents = (Int_t) gAlice->TreeE ()->GetEntries ();
117 for (Int_t ievent = 0; ievent < fNevents; ievent++)
119 gAlice->GetEvent (ievent);
120 if (gAlice->TreeH () == 0)
122 if (gAlice->TreeS () == 0)
123 gAlice->MakeTree ("S");
130 sprintf (branchname, "%s", FMD->GetName ());
131 //Make branch for digits
132 FMD->MakeBranch ("S");
134 //Now made SDigits from hits, for PHOS it is the same
135 Int_t volume, sector, ring, charge;
137 Float_t de[10][50][150];
138 Int_t ivol, isec, iring;
142 TClonesArray *FMDhits = FMD->Hits ();
144 // Event ------------------------- LOOP
146 for (ivol = 0; ivol < 10; ivol++)
147 for (isec = 0; isec < 50; isec++)
148 for (iring = 0; iring < 150; iring++)
149 de[ivol][isec][iring] = 0;
153 FMDhits = FMD->Hits ();
154 TTree *TH = gAlice->TreeH ();
155 Stat_t ntracks = TH->GetEntries ();
156 for (Int_t track = 0; track < ntracks; track++)
158 gAlice->ResetHits ();
159 nbytes += TH->GetEvent (track);
160 particle = gAlice->Particle (track);
161 Int_t nhits = FMDhits->GetEntriesFast ();
163 for (hit = 0; hit < nhits; hit++)
165 fmdHit = (AliFMDhit *) FMDhits->UncheckedAt (hit);
167 volume = fmdHit->Volume ();
168 sector = fmdHit->NumberOfSector ();
169 ring = fmdHit->NumberOfRing ();
171 de[volume][sector][ring] += e;
178 Float_t I = 1.664 * 0.04 * 2.33 / 22400; // = 0.69e-6;
179 for (ivol = 1; ivol < 6; ivol++)
181 for (isec = 1; isec <= NumberOfSectors[ivol-1]; isec++)
183 for (iring = 1; iring <= NumberOfRings[ivol-1]; iring++)
188 charge = Int_t (de[ivol][isec][iring] / I);
191 //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV)
193 Float_t channelWidth = (22400 * 30) / 1024;
195 digit[4] = Int_t (digit[3] / channelWidth);
196 FMD->AddSDigit(digit);
202 gAlice->TreeS()->Reset();
203 gAlice->TreeS()->Fill();
204 gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
210 //__________________________________________________________________
211 void AliFMDSDigitizer::SetSDigitsFile(char * file ){
212 if(!fSDigitsFile.IsNull())
213 cout << "Changing SDigits file from " <<(char *)fSDigitsFile.Data() << " to " << file << endl ;
216 //__________________________________________________________________
217 void AliFMDSDigitizer::Print(Option_t* option)const
219 cout << "------------------- "<< GetName() << " -------------" << endl ;
220 if(fSDigitsFile.IsNull())
221 cout << " Writing SDigitis to file galice.root "<< endl ;
223 cout << " Writing SDigitis to file " << (char*) fSDigitsFile.Data() << endl ;