]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSresponseSPDdubna.cxx
Tests and example macros working with ESD (Yu.Belikov)
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSPDdubna.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15 #include <Riostream.h>
16 #include <TMath.h>
17 #include <TRandom.h>
18
19 #include "AliITSresponseSPDdubna.h"
20  
21 //___________________________________________
22 ClassImp(AliITSresponseSPDdubna)        
23
24 AliITSresponseSPDdubna::AliITSresponseSPDdubna() : AliITSresponse(){
25    // Default constructor
26    // Inputs:
27    //    none.
28    // Outputs:
29    //    none.
30    // Return:
31    //    A default constructed AliITSresponseSPD class
32
33    SetNoiseParam();  // fNoise, fBaseline
34    SetThreshold();   // fThreshold
35    SetCouplings();   // fCouplCol, fCouplRow
36    SetFractionDeadPixels(); // fDeadPixels
37    SetDataType();    // fDataType
38 }
39 //_________________________________________________________________________
40 Bool_t AliITSresponseSPDdubna::IsPixelDead(Int_t mod,Int_t ix,Int_t iz) const {
41   // Returns kTRUE if pixel is dead
42   // Inputs:
43   //    Int_t mod      module number
44   //    Int_t ix       x pixel number
45   //    Int_t iz       z pixel number
46   // Outputs:
47   //    none.
48   // Return:
49   //    kFALSE if pixel is alive, or kTRUE if pixel is dead.
50   Bool_t  dead = kFALSE;
51   Int_t   seed;
52   static TRandom ran; // don't use gRandom. This must not be a true randome
53   // sequence. These sequence must be random one and then fully repetable.
54
55   seed = mod*256*256+iz*256+ix;
56   ran.SetSeed(seed);
57   if(ran.Rndm(0)<fDeadPixels) dead = kTRUE;
58   return dead;
59 }
60 //----------------------------------------------------------------------
61 void AliITSresponseSPDdubna::Print(ostream *os){
62     // Standard output format for this class.
63     // Inputs:
64     //    ostream *os  Pointer to the output stream
65     // Outputs:
66     //    none:
67     // Return:
68     //    none.
69 #if defined __GNUC__
70 #if __GNUC__ > 2
71     ios::fmtflags fmt;
72 #else
73     Int_t fmt;
74 #endif
75 #else
76 #if defined __ICC || defined __ECC
77     ios::fmtflags fmt;
78 #else
79     Int_t fmt;
80 #endif
81 #endif
82
83     AliITSresponse::Print(os);
84     fmt = os->setf(ios::scientific);  // set scientific floating point output
85     *os << fNoise << " " << fBaseline << " " << fCouplCol << " ";
86     *os << fCouplRow << " "<< fThreshold << " " << fDeadPixels << " ";
87     *os << fDataType;
88 //    *os << " " << endl;
89     os->flags(fmt); // reset back to old formating.
90     return;
91 }
92 //----------------------------------------------------------------------
93 void AliITSresponseSPDdubna::Read(istream *is){
94     // Standard input format for this class.
95     // Inputs:
96     //    ostream *os  Pointer to the output stream
97     // Outputs:
98     //    none:
99     // Return:
100     //    none.
101
102     AliITSresponseSPDdubna::Read(is);
103     *is >> fNoise >> fBaseline >> fCouplCol >> fCouplRow;
104     *is >> fThreshold >> fDeadPixels >> fDataType;
105     return;
106 }
107 //----------------------------------------------------------------------
108 ostream &operator<<(ostream &os,AliITSresponseSPDdubna &p){
109     // Standard output streaming function.
110     // Inputs:
111     //    ostream *os  Pointer to the output stream
112     // Outputs:
113     //    none:
114     // Return:
115     //    none.
116
117     p.Print(&os);
118     return os;
119 }
120 //----------------------------------------------------------------------
121 istream &operator>>(istream &is,AliITSresponseSPDdubna &r){
122     // Standard input streaming function.
123     // Inputs:
124     //    ostream *os  Pointer to the output stream
125     // Outputs:
126     //    none:
127     // Return:
128     //    none.
129
130     r.Read(&is);
131     return is;
132 }
133 //----------------------------------------------------------------------
134