KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVCouple.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Thu Jun 17 16:10:54 2010
2 //Author: bonnet
3 
4 #include "KVCouple.h"
5 
7 
8 
9 
10 
14 {
15  // Default constructor
16 }
17 
18 
19 //----------------------------------------------
20 
23 
25 {
26 
27  //printf("zf=%d zmax=%d\n",zf,zsup);
28  zfra = zf;
29  zmax = zsup;
30 
31  Int_t div = 2;
32 
33  zlim = zfra / div;
34  Double_t zmoy = zfra / Double_t(div);
35  Double_t diff = zmoy - zlim;
36  Int_t sup = TMath::Nint(diff * div);
37  if (sup >= 1) {
38  zlim += 1;
39  }
40  Int_t zref = 0;
41  ((zfra >= zmax) ? zref = zmax : zref = zfra);
42 
43  nbre = zref - zlim + 1;
44  if (nbre > 0) {
45  tz1.reserve(nbre);
46  tz2.reserve(nbre);
47  Int_t z1 = 0;
48  for (Int_t ii = 0; ii < nbre; ii += 1) {
49  z1 = zref - ii;
50  tz1[ii] = z1;
51  tz2[ii] = zfra - z1;
52  //printf(" %d %d %d\n",ii,z1,zfra-z1);
53  }
54  init = kTRUE;
55  }
56  else {
57  //return;
58  ResetVars();
59  }
60 
61 }
62 
63 
64 //----------------------------------------------
65 
67 
69 {
70 
71  zfra = zf;
72  zmax = zsup;
73 
74  zlim = zfra / div;
75  Double_t zmoy = zfra / Double_t(div);
76  Double_t diff = zmoy - zlim;
77  Int_t sup = TMath::Nint(diff * div);
78  if (sup >= 1) {
79  zlim += 1;
80  }
81 
82  if (zfra >= zmax) {
83  //cas 1
84  nbre = zmax - zlim + 1;
85  if (nbre > 0) {
86 
87  tz1.reserve(nbre);
88  tz2.reserve(nbre);
89  Int_t z1 = 0;
90  for (Int_t ii = 0; ii < nbre; ii += 1) {
91  z1 = zmax - ii;
92  tz1[ii] = z1;
93  tz2[ii] = zfra - z1;
94  }
95  init = kTRUE;
96  }
97  else {
98  //return;
99  ResetVars();
100  }
101  }
102  else {
103  nbre = zfra - zlim + 1;
104  if (nbre > 0) {
105 
106  tz1.reserve(nbre);
107  tz2.reserve(nbre);
108  Int_t z1 = 0;
109  for (Int_t ii = 0; ii < nbre; ii += 1) {
110  z1 = zfra - ii;
111  tz1[ii] = z1;
112  tz2[ii] = zfra - z1;
113  }
114  init = kTRUE;
115  }
116  else {
117  //return;
118  ResetVars();
119  }
120  }
121 }
122 
123 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
double Double_t
const Bool_t kTRUE
Handles binary decomposition of an integer.
Definition: KVCouple.h:15
Int_t nbre
Definition: KVCouple.h:22
std::vector< Int_t > tz1
Definition: KVCouple.h:18
Int_t zfra
Definition: KVCouple.h:23
Int_t zmax
Definition: KVCouple.h:24
Bool_t init
Definition: KVCouple.h:25
KVCouple()
Default constructor.
Definition: KVCouple.cpp:13
Int_t zlim
Definition: KVCouple.h:21
void ResetVars()
Definition: KVCouple.h:33
std::vector< Int_t > tz2
Definition: KVCouple.h:19
Int_t Nint(T x)