For Pythia with tune don't switch off MI in ConfigHeavyFlavor
[u/mrichter/AliRoot.git] / ITS / AliITSFOGeneratorSPD.cxx
CommitLineData
ad7f2bfa 1/////////////////////////////////////////////////////////////////////
2// Author: Henrik Tydesjo //
3// //
4// This class is used to generate Fast-OR signals from SPD chips. //
5// //
6// This procedure is meant to be used during the digitization, //
7// and will be based on the number of pixels firing in each chip. //
8// The method 'ProcessPixelHit' should be used for each fired //
9// pixel. An efficiency value on Fast-Or signal creation upon a //
10// single fired pixel will then be used. Optionally, there may be //
11// one value per chip or even one value per column. These values //
12// are taken from the class AliITSFOEfficiencySPD, normally placed //
13// in OCDB. //
14// //
15// Through a similar class, AliITSFONoiseSPD, there is a //
16// possibility to apply random noise to the generation of fast-or //
17// signals. This will then be performed by method 'ProcessNoise', //
18// normally called after the processing of the fired pixels. //
19// //
20// The output signals are represented by the AliITSFOsignalsSPD //
21// class. Basically, it contains a bit map with all the 1200 pixel //
22// chips. //
23/////////////////////////////////////////////////////////////////////
24
25#include "AliITSFOGeneratorSPD.h"
26#include "AliITSRawStreamSPD.h"
27#include <TRandom.h>
28
29AliITSFOGeneratorSPD::AliITSFOGeneratorSPD() :
30 fSignals(), fOCDBEff(NULL), fOCDBNoise(NULL)
31{
32 // default constructor
33}
34//______________________________________________________________________
35AliITSFOGeneratorSPD::AliITSFOGeneratorSPD(AliITSFOEfficiencySPD* ocdbEff, AliITSFONoiseSPD* ocdbNoise) :
36 fSignals(), fOCDBEff(ocdbEff), fOCDBNoise(ocdbNoise)
37{
38 // constructor
39}
40//______________________________________________________________________
41AliITSFOGeneratorSPD::AliITSFOGeneratorSPD(const AliITSFOGeneratorSPD& handle):
42 fSignals(handle.fSignals), fOCDBEff(handle.fOCDBEff), fOCDBNoise(handle.fOCDBNoise)
43{
44 // copy constructor
45}
46//______________________________________________________________________
47AliITSFOGeneratorSPD::~AliITSFOGeneratorSPD() {
48 // destructor
49}
50//______________________________________________________________________
51AliITSFOGeneratorSPD& AliITSFOGeneratorSPD::operator=(const AliITSFOGeneratorSPD& handle) {
52 // assignment operator
53 if (this!=&handle) {
54 fSignals = handle.fSignals;
55 fOCDBEff = handle.fOCDBEff;
56 fOCDBNoise = handle.fOCDBNoise;
57 }
58 return *this;
59}
60//______________________________________________________________________
61void AliITSFOGeneratorSPD::SetEfficiencyAndNoise(AliITSFOEfficiencySPD* ocdbEff, AliITSFONoiseSPD* ocdbNoise) {
62 // Method to give pointers to the OCDB entries, needed by methods ProcessPixelHit and ProcessNoise
63 SetEfficiency(ocdbEff);
64 SetNoise(ocdbNoise);
65}
66//______________________________________________________________________
67void AliITSFOGeneratorSPD::SetEfficiency(AliITSFOEfficiencySPD* ocdbEff) {
68 // Method to give pointer to the OCDB efficiency entry
69 fOCDBEff = ocdbEff;
70}
71//______________________________________________________________________
72void AliITSFOGeneratorSPD::SetNoise(AliITSFONoiseSPD* ocdbNoise) {
73 // Method to give pointer to the OCDB noise entry
74 fOCDBNoise = ocdbNoise;
75}
76//______________________________________________________________________
77void AliITSFOGeneratorSPD::ProcessPixelHit(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
78 // Here it will be decided wether a fired pixel will give rise to a fast-or signal or not
79 if (eq>=20 || hs>=6 || chip>=10 || col>=32 || row>=256) {
80 Error("AliITSFOGeneratorSPD::ProcessPixelHit", "eq,hs,chip,col,row (%d,%d,%d,%d,%d) out of bounds.",
81 eq,hs,chip,col,row);
82 return;
83 }
84 if (fOCDBEff==NULL) {
85 Error("AliITSFOGeneratorSPD::ProcessPixelHit", "No AliITSFOEfficiencySPD entry has been provided.");
86 return;
87 }
88 // simulate if this fired pixel gives rise to a fast-or signal:
89 if (gRandom->Rndm() < fOCDBEff->GetColumnEfficiency(eq,hs,chip,col)) {
90 fSignals.SetSignal(eq,hs,chip);
91 }
92}
93//______________________________________________________________________
94void AliITSFOGeneratorSPD::ProcessPixelHitM(UInt_t module, UInt_t colM, UInt_t rowM) {
95 // Converts offline coordinates to online, and calls ProcessPixelHit
96 if (module>=240 || colM>=160 || rowM>=256) {
97 Error("AliITSFOGeneratorSPD::ProcessPixelHitM", "module,colM,rowM (%d,%d,%d) out of bounds.",
98 module,colM,rowM);
99 return;
100 }
101 UInt_t eq,hs,chip,col,row;
102 if (AliITSRawStreamSPD::OfflineToOnline(module,colM,rowM,eq,hs,chip,col,row)) {
103 ProcessPixelHit(eq,hs,chip,col,row);
104 }
105}
106//______________________________________________________________________
107void AliITSFOGeneratorSPD::ProcessNoise() {
108 //
109 if (fOCDBNoise==NULL) {
110 Error("AliITSFOGeneratorSPD::ProcessNoise", "No AliITSFONoiseSPD entry has been provided.");
111 return;
112 }
113 // simulate if each pixel chip will give rise to a random noise induced fast-or signal:
114 for (UInt_t eq=0; eq<20; eq++) {
115 for (UInt_t hs=0; hs<6; hs++) {
116 for (UInt_t chip=0; chip<10; chip++) {
117 if (gRandom->Rndm() < fOCDBNoise->GetChipNoise(eq,hs,chip)) {
118 fSignals.SetSignal(eq,hs,chip);
119 }
120 }
121 }
122 }
123}