1 /**************************************************************************
2 * Copyright(c) 1998-2000, 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 //////////////////////////////////////////////////////////////////////////////
18 // Forward Multiplicity Detector based on Silicon plates //
19 // This class contains the procedures simulation ADC signal for //
20 // the Forward Multiplicity detector : hits -> digits //
21 // ADC signal consists //
22 // - number of detector; //
23 // - number of ring; //
24 // - number of sector; //
25 // - ADC signal in this channel //
27 //////////////////////////////////////////////////////////////////////////////
31 #include <TObjArray.h>
33 #include <TDirectory.h>
37 #include "AliFMDDigitizer.h"
39 #include "AliFMDhit.h"
40 #include "AliFMDdigit.h"
41 #include "AliRunDigitizer.h"
44 #include "AliLoader.h"
45 #include "AliRunLoader.h"
48 #include <Riostream.h>
49 #include <Riostream.h>
51 ClassImp(AliFMDDigitizer)
53 //___________________________________________
54 AliFMDDigitizer::AliFMDDigitizer() :AliDigitizer()
56 // Default ctor - don't use it
60 //___________________________________________
61 AliFMDDigitizer::AliFMDDigitizer(AliRunDigitizer* manager)
62 :AliDigitizer(manager)
64 // ctor which should be used
67 Info("AliFMDDigitizer"," processed");
71 //------------------------------------------------------------------------
72 AliFMDDigitizer::~AliFMDDigitizer()
78 //------------------------------------------------------------------------
79 Bool_t AliFMDDigitizer::Init()
82 // cout<<"AliFMDDigitizer::Init"<<endl;
87 //---------------------------------------------------------------------
89 void AliFMDDigitizer::Exec(Option_t * /*option*/)
93 Conver hits to digits:
97 - ADC signal in this channel
100 AliRunLoader *inRL, *outRL;//in and out Run Loaders
101 AliLoader *pInFMD, *pOutFMD;// in and out ITSLoaders
103 outRL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
104 pOutFMD = outRL->GetLoader("FMDLoader");
108 Info("Hits2Digits Exec"," start...";
112 Int_t volume, sector, ring, charge;
114 Float_t de[10][50][520];
117 Int_t ivol, iSector, iRing;
118 for (Int_t i=0; i<10; i++)
119 for(Int_t j=0; j<50; j++)
120 for(Int_t ij=0; ij<520; ij++)
122 Int_t numberOfRings[5]= {512,256,512,256,512};
123 Int_t numberOfSector[5] = {20,40,20,40,20};
130 inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0));
134 Error("Exec","Can not find Run Loader for input stream 0");
138 if (!inRL->GetAliRun()) inRL->LoadgAlice();
140 AliFMD * fFMD = (AliFMD *) inRL->GetAliRun()->GetDetector("FMD");
144 Error("Exec","Can not get FMD from gAlice");
147 // Loop over files to digitize
149 Int_t nFiles=GetManager()->GetNinputs();
150 for (Int_t inputFile=0; inputFile<nFiles;inputFile++)
154 Info(" Digitizing event number ",fManager->GetOutputEventNr()) ;
160 inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
161 pInFMD = inRL->GetLoader("FMDLoader");
162 pInFMD->LoadHits("READ");
165 tH = pInFMD->TreeH();
168 pInFMD->LoadHits("read");
169 tH = pInFMD->TreeH();
171 brHits = tH->GetBranch("FMD");
173 fFMD->SetHitsAddressBranch(brHits);
175 Fatal("Exec","EXEC Branch FMD hit not found");
177 TClonesArray *fFMDhits = fFMD->Hits ();
179 Int_t ntracks = (Int_t) tH->GetEntries();
181 for (Int_t track = 0; track < ntracks; track++)
183 brHits->GetEntry(track);
184 Int_t nhits = fFMDhits->GetEntries ();
186 for (hit = 0; hit < nhits; hit++)
188 fmdHit = (AliFMDhit *) fFMDhits->UncheckedAt(hit);
190 volume = fmdHit->Volume ();
191 sector = fmdHit->NumberOfSector ();
192 ring = fmdHit->NumberOfRing ();
194 de[volume][sector][ring] += e;
203 // Put noise and make ADC signal
204 Float_t mipI = 1.664 * 0.04 * 2.33 / 22400; // = 6.923e-6;
205 for ( ivol=1; ivol<=5; ivol++){
206 for ( iSector=1; iSector<=numberOfSector[ivol-1]; iSector++){
207 for ( iRing=1; iRing<=numberOfRings[ivol-1]; iRing++){
211 charge = Int_t (de[ivol][iSector][iRing] / mipI);
212 Int_t pedestal=Int_t(gRandom->Gaus(500,250));
213 // digit[3]=PutNoise(charge);
214 digit[3]=charge + pedestal;
215 if(digit[3]<= 500) digit[3]=500;
216 //dynamic range from MIP(0.155MeV) to 30MIP(4.65MeV)
218 Float_t channelWidth=(22400*50)/1024;
219 digit[4]=Int_t(digit[3]/channelWidth);
220 if (digit[4]>1024) digit[4]=1024;
221 fFMD->AddDigit(digit);
226 pOutFMD->LoadDigits("update");
227 TTree* treeD = pOutFMD->TreeD();
230 pOutFMD->MakeTree("D");
231 treeD = pOutFMD->TreeD();
236 fFMD->MakeBranchInTreeD(treeD);
237 brD = treeD->GetBranch("FMD");
242 pOutFMD->WriteDigits("OVERWRITE");
243 pOutFMD->UnloadHits();
244 pOutFMD->UnloadDigits();