/[PAMELA software]/tof/flight/ToFNuclei/src/ToFNuclei.cpp
ViewVC logotype

Diff of /tof/flight/ToFNuclei/src/ToFNuclei.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pamela, Mon Oct 13 13:41:39 2008 UTC revision 1.2 by pamelats, Mon Mar 2 11:42:51 2009 UTC
# Line 1  Line 1 
1    //*****************************************************
2    //24-feb-2009: introduced "beta_in" and "Set_Beta":
3    // beta_in is set to 100 by default. If it is not overwritten
4    // by "Set_Beta" (ToFNuclei.h), the code is used as before.
5    // If beta_in was set by the user using "Set_Beta", this beta
6    // is taken for the calculations.
7    //26-feb-2009: Inserted S115B calibartions from Lucia
8    //
9    //*****************************************************
10  #include <ToFNuclei.h>  #include <ToFNuclei.h>
11    
12  //--------------------------------------  //--------------------------------------
# Line 14  ToFNuclei::ToFNuclei(PamLevel2 *l2p){   Line 23  ToFNuclei::ToFNuclei(PamLevel2 *l2p){  
23    //    //
24    L2 = l2p;    L2 = l2p;
25    //    //
26      beta_in = 100.;
27      //
28    if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n");    if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n");
29    //    //
30    OBT = 0;    OBT = 0;
# Line 30  void ToFNuclei::Clear(){ Line 41  void ToFNuclei::Clear(){
41    ncount_trk = 0.;    ncount_trk = 0.;
42    charge_trk = 0.;    charge_trk = 0.;
43    memset (charge_layer_trk,0,6*sizeof(Float_t));  //    memset (charge_layer_trk,0,6*sizeof(Float_t));  //
44      memset (charge_PMT_trk,0,48*sizeof(Float_t));  //
45    memset (layerinfo_trk,0,6*sizeof(Int_t));  //    memset (layerinfo_trk,0,6*sizeof(Int_t));  //
46    ncount_std = 0.;    ncount_std = 0.;
47    charge_std = 0.;    charge_std = 0.;
48    memset (charge_layer_std,0,6*sizeof(Float_t));  //    memset (charge_layer_std,0,6*sizeof(Float_t));  //
49      memset (charge_PMT_std,0,48*sizeof(Float_t));  //
50    memset (layerinfo_std,0,6*sizeof(Int_t));  //    memset (layerinfo_std,0,6*sizeof(Int_t));  //
51  };  };
52    
# Line 83  void ToFNuclei::Process(Int_t ntr){ Line 96  void ToFNuclei::Process(Int_t ntr){
96      newentry = true;      newentry = true;
97    };    };
98    //    //
99    if ( !newentry ) return;    if ( !newentry ) {
100      return;
101                      }
102    //    //
103    tr = ntr;    tr = ntr;
104    //    //
# Line 96  void ToFNuclei::Process(Int_t ntr){ Line 111  void ToFNuclei::Process(Int_t ntr){
111    
112    Clear();    Clear();
113    
114    //    //  cout<<"beta_in = "<<beta_in<<endl;
115    
116    
117    Double_t time = L2->GetOrbitalInfo()->absTime;    Double_t time = L2->GetOrbitalInfo()->absTime;
118    
# Line 108  void ToFNuclei::Process(Int_t ntr){ Line 124  void ToFNuclei::Process(Int_t ntr){
124  //if (L2->GetTrkLevel2()->GetNTracks()!=1) return;  //if (L2->GetTrkLevel2()->GetNTracks()!=1) return;
125  if (L2->GetTrkLevel2()->GetNTracks()==1) {  if (L2->GetTrkLevel2()->GetNTracks()==1) {
126    
127    /*
128  Float_t  PMTsat[48] = {  Float_t  PMTsat[48] = {
129  3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37, 3130.05, 3087.07, 3112.22,  3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37, 3130.05, 3087.07, 3112.22,
130  3102.92, 3080.58, 3092.55, 3087.94, 3125.03, 3094.09, 3143.16,  3102.92, 3080.58, 3092.55, 3087.94, 3125.03, 3094.09, 3143.16,
131  3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53, 3097.11, 3133.53, 3114.73, 3113.01, 3091.19,  3125.51, 3181.27, 3092.09, 3124.98, 3069.3, 3095.53, 3097.11, 3133.53, 3114.73, 3113.01, 3091.19,
132  3097.99, 3033.84, 3134.98, 3081.37, 3111.04, 3066.77, 3108.17,  3097.99, 3033.84, 3134.98, 3081.37, 3111.04, 3066.77, 3108.17,
133  3133, 3111.06, 3052.52, 3140.66, 3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11  3133, 3111.06, 3052.52, 3140.66, 3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11
134  }  };
135  ;  */
136    
137    // new values from Napoli dec 2008
138    Float_t  PMTsat[48] = {
139    3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,
140    3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,
141    3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,
142    3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,
143    3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,
144    3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };
145    
146    for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.;  // safety margin
147    
148    
149    Float_t C0t[48][9] = {
150    0, 1, 2, 3, 4, 5, 6, 8, 92,
151    0, 1, 2, 3, 4, 5, 6, 8, 92,
152    0, 1, 2, 3, 4, 5, 6, 8, 92,
153    0, 1, 2, 3, 4, 5, 6, 8, 92,
154    0, 1, 2, 3, 4, 5, 6, 8, 92,
155    0, 1, 2, 3, 4, 5, 6, 8, 92,
156    0, 1, 2, 3, 4, 5, 6, 8, 92,
157    0, 1, 2, 3, 4, 5, 6, 8, 92,
158    0, 1, 2, 3, 4, 5, 6, 8, 92,
159    0, 1, 2, 3, 4, 5, 6, 8, 92,
160    0, 1, 2, 3, 4, 5, 6, 8, 92,
161    0, 1, 2, 3, 4, 5, 6, 8, 92,
162    0, 1, 2, 3, 4, 5, 6, 8, 92,
163    0, 1, 2, 3, 4, 5, 6, 8, 92,
164    0, 1, 2, 3, 4, 5, 6, 8, 92,
165    0, 1, 2, 3, 4, 5, 6, 8, 92,
166    0, 1, 2, 3, 4, 5, 6, 8, 92,
167    0, 1, 2, 3, 4, 5, 6, 8, 92,
168    0, 1, 2, 3, 4, 5, 6, 8, 92,
169    0, 1, 2, 3, 4, 5, 6, 8, 92,
170    0, 1, 2, 3, 4, 5, 6, 8, 92,
171    0, 1, 2, 3, 4, 5, 6, 8, 92,
172    0, 1, 2, 3, 4, 5, 6, 8, 92,
173    0, 1, 2, 3, 4, 5, 6, 8, 92,
174    0, 1, 2, 3, 4, 5, 6, 8, 92,
175    0, 1, 2, 3, 4, 5, 6, 8, 92,
176    0, 1, 2, 3, 4, 5, 6, 8, 92,
177    0, 1, 2, 3, 4, 5, 6, 8, 92,
178    0, 1, 2, 3, 4, 5, 6, 8, 92,
179    0, 1, 2, 3, 4, 5, 6, 8, 92,
180    0, 1, 2, 3, 4, 5, 6, 8, 92,
181    0, 1, 2, 3, 4, 5, 6, 8, 92,
182    0, 1, 2, 3, 4, 5, 6, 8, 92,
183    0, 1, 2, 3, 4, 5, 6, 8, 92,
184    0, 1, 2, 3, 4, 5, 6, 8, 92,
185    0, 1, 2, 3, 4, 5, 6, 8, 92,
186    0, 1, 2, 3, 4, 5, 6, 8, 92,
187    0, 1, 2, 3, 4, 5, 6, 8, 92,
188    0, 1, 2, 3, 4, 5, 6, 8, 92,
189    0, 1, 2, 3, 4, 5, 6, 8, 92,
190    0, 1, 2, 3, 4, 5, 6, 8, 92,
191    0, 1, 2, 3, 4, 5, 6, 8, 92,
192    0, 1, 2, 3, 4, 5, 6, 8, 92,
193    0, 1, 2, 3, 4, 5, 6, 8, 92,
194    0, 1, 2, 3, 4, 5, 6, 8, 92,
195    0, 1, 2, 3, 4, 5, 6, 8, 92,
196    0, 1, 2, 3, 4, 5, 6, 8, 92,
197    0, 1, 2, 3, 4, 5, 6, 8, 92} ;
198    
 Float_t C0t[48][9] = {0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,  
 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,  
 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,  
 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,  
 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,  
 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,  
 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,  
 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92 };  
199    
200  Float_t A0t[48][9] = {  Float_t A0t[48][9] = {
201  0, 0.90472, 5.19581, 7.99982, 11, 13, 16, 18, 2000, 0, 0.7774, 5.15121, 7.99976, 11, 13, 16, 18, 2000, 0, 1.18414, 5.1952, 8, 11, 13, 16, 17.9999, 2000, 0, 1.0189, 5.61869, 8, 11, 13.0006, 15.9998, 18.0014, 2000, 0, 1.08725, 4.4728, 7.99979, 11,  0, 0.90472, 5.19581, 7.99982, 11, 13, 16, 18, 2000,
202  13.0002, 16, 18, 2000, 0, 0.946462, 4.69554, 7.99994, 11, 13.0001, 16, 18, 2000, 0, 1.13176, 4.57483, 7.99999, 11, 13.0002, 15.9999, 18.0002, 2000, 0, 1.00872, 4.99316, 8, 11, 13, 16, 18, 2000, 0, 1.19891, 5.01355, 8, 11, 13.0003, 16, 18, 2000, 0, 0.5,  0, 0.7774, 5.15121, 7.99976, 11, 13, 16, 18, 2000,
203  2, 4.5, 5.50003, 6.50028, 8.00004, 8.99989, 2000, 0, 1.16961, 4.59028, 8, 11, 13.0001, 16, 18, 2000, 0, 0.989643, 5.21958, 7.99998, 11, 13, 16,  0, 1.18414, 5.1952, 8, 11, 13, 16, 17.9999, 2000,
204  17.9999, 2000, 0, 0.952029, 5.19598, 7.99998, 11, 13.0005, 16.0005, 18, 2000, 0, 0.736833, 4.95596, 8, 11, 13, 16, 18, 2000, 0, 1.34007, 3.74275, 8, 11, 13, 16, 18, 2000, 0, 1.47101, 4.31154, 8, 11, 13, 16, 18,  0, 1.0189, 5.61869, 8, 11, 13.0006, 15.9998, 18.0014, 2000,
205  2000, 0, 1.3754, 4.83141, 8.00002, 11, 13, 16, 18, 2000, 0, 1.47712, 5.79783, 8, 11, 13, 16, 18, 2000, 0, 1.19127, 5.35796, 7.99996, 11, 13,  0, 1.08725, 4.4728, 7.99979, 11, 13.0002, 16, 18, 2000,
206  16, 18, 2000, 0, 1.25745, 5.98391, 8, 11, 13.0004, 16.0001, 18.0001, 2000, 0, 1.18024, 5.40107, 7.99999, 11, 13, 16, 18.0001, 2000, 0, 0.961883,  0, 0.946462, 4.69554, 7.99994, 11, 13.0001, 16, 18, 2000,
207  5.10846, 7.99999, 11, 13, 16, 18, 2000, 0, 1.23192, 6.21098, 8, 11, 13.0005, 16, 18.0003, 2000, 0, 1.15846, 5.23573, 7.99995,  0, 1.13176, 4.57483, 7.99999, 11, 13.0002, 15.9999, 18.0002, 2000,
208  11, 13, 16, 18.0002, 2000, 0, 1.26163, 5.5425, 8.00001, 11, 13.0002, 16.0006, 18, 2000, 0, 1.12754, 5.57064, 7.99999, 11, 13, 16, 18.0002,  0, 1.00872, 4.99316, 8, 11, 13, 16, 18, 2000,
209  2000, 0, 1.22768, 6.06283, 8, 11, 13.0002, 16, 18, 2000, 0, 1.83569, 5.87584, 8.00006, 11, 13.0005, 16, 18,  0, 1.19891, 5.01355, 8, 11, 13.0003, 16, 18, 2000,
210  2000, 0, 1.61434, 5.56634, 7, 7.99999, 8.99999, 14.999, 16, 2000, 0, 1.61287, 5.46416, 7.99989, 10, 12, 14.9997, 16, 2000, 0, 1.49053,  0, 0.5, 2.284, 3.12, 8.795, 6.257, 7.841, 6.1743, 2000,
211  6.21581, 9.00001, 12, 14, 16, 22, 2000, 0, 1.64579, 5.08498, 7.99989, 10, 12, 15, 16, 2000, 0, 1.83474, 6.29746, 9.00001, 12, 14.0001, 16.0001, 22,  0, 1.16961, 4.59028, 8, 11, 13.0001, 16, 18, 2000,
212  2000, 0, 1.80066, 6.19725, 9, 12, 14, 16, 22, 2000, 0, 1.9025, 5.83736, 8, 10, 12, 14.9999, 16, 2000, 0, 1.90163, 5.62801, 7.99999, 10, 12, 15, 16, 2000, 0, 2.5518,  0, 0.989643, 5.21958, 7.99998, 11, 13, 16, 17.9999, 2000,
213  5.97325, 9.00012, 12, 15, 18, 22, 2000, 0, 2.53476, 5.75312, 9.00007, 12, 15, 18, 22, 2000, 0, 2.67784, 6.9232, 9.00005, 12, 15, 18, 22, 2000, 0, 2.62769, 7.22552, 9.00003,  0, 0.952029, 5.19598, 7.99998, 11, 13.0005, 16.0005, 18, 2000,
214  12.0001, 15, 18, 22, 2000, 0, 2.58088, 6.30413, 9.0001, 12, 15, 18, 22, 2000, 0, 2.48219, 7.06085, 9.00005, 12, 15, 18, 22, 2000, 0, 3.23157, 5.20668, 9.00007, 12, 15,  0, 0.736833, 4.95596, 8, 11, 13, 16, 18, 2000,
215  18, 22, 2000, 0, 3.38244, 6.45172, 9.00006, 12.0001, 15, 18.0001, 22, 2000, 0, 3.14595, 5.29036, 9.00008, 12, 15, 18, 22.0001, 2000, 0, 3.34692, 6.17283, 9.00041, 12,  0, 1.34007, 3.74275, 8, 11, 13, 16, 18, 2000,
216  15, 18.0001, 22, 2000, 0, 3.16915, 4.25973, 9.00015, 12, 15, 18, 22, 2000, 0, 3.25809, 5.58971, 9.00068, 12, 15, 18,  0, 1.47101, 4.31154, 8, 11, 13, 16, 18, 2000,
217  22.0001, 2000 } ;  0, 1.3754, 4.83141, 8.00002, 11, 13, 16, 18, 2000,
218    0, 1.47712, 5.79783, 8, 11, 13, 16, 18, 2000,
219    0, 1.19127, 5.35796, 7.99996, 11, 13, 16, 18, 2000,
220    0, 1.25745, 5.98391, 8, 11, 13.0004, 16.0001, 18.0001, 2000,
221    0, 1.18024, 5.40107, 7.99999, 11, 13, 16, 18.0001, 2000,
222    0, 0.961883, 5.10846, 7.99999, 11, 13, 16, 18, 2000,
223    0, 1.23192, 6.21098, 8, 11, 13.0005, 16, 18.0003, 2000,
224    0, 1.15846, 5.23573, 7.99995, 11, 13, 16, 18.0002, 2000,
225    0, 1.26163, 5.5425, 8.00001, 11, 13.0002, 16.0006, 18, 2000,
226    0, 1.12754, 5.57064, 7.99999, 11, 13, 16, 18.0002, 2000,
227    0, 1.22768, 6.06283, 8, 11, 13.0002, 16, 18, 2000,
228    0, 1.83569, 5.87584, 8.00006, 11, 13.0005, 16, 18, 2000,
229    0, 1.61434, 5.56634, 7, 7.99999, 8.99999, 14.999, 16, 2000,
230    0, 1.61287, 5.46416, 7.99989, 10, 12, 14.9997, 16, 2000,
231    0, 1.49053, 6.21581, 9.00001, 12, 14, 16, 22, 2000,
232    0, 1.64579, 5.08498, 7.99989, 10, 12, 15, 16, 2000,
233    0, 1.83474, 6.29746, 9.00001, 12, 14.0001, 16.0001, 22, 2000,
234    0, 1.80066, 6.19725, 9, 12, 14, 16, 22, 2000,
235    0, 1.9025, 5.83736, 8, 10, 12, 14.9999, 16, 2000,
236    0, 1.90163, 5.62801, 7.99999, 10, 12, 15, 16, 2000,
237    0, 2.5518, 5.97325, 9.00012, 12, 15, 18, 22, 2000,
238    0, 2.53476, 5.75312, 9.00007, 12, 15, 18, 22, 2000,
239    0, 2.67784, 6.9232, 9.00005, 12, 15, 18, 22, 2000,
240    0, 2.62769, 7.22552, 9.00003, 12.0001, 15, 18, 22, 2000,
241    0, 2.58088, 6.30413, 9.0001, 12, 15, 18, 22, 2000,
242    0, 2.48219, 7.06085, 9.00005, 12, 15, 18, 22, 2000,
243    0, 3.23157, 5.20668, 9.00007, 12, 15, 18, 22, 2000,
244    0, 3.38244, 6.45172, 9.00006, 12.0001, 15, 18.0001, 22, 2000,
245    0, 3.14595, 5.29036, 9.00008, 12, 15, 18, 22.0001, 2000,
246    0, 3.34692, 6.17283, 9.00041, 12, 15, 18.0001, 22, 2000,
247    0, 3.16915, 4.25973, 9.00015, 12, 15, 18, 22, 2000,
248    0, 3.25809, 5.58971, 9.00068, 12, 15, 18, 22.0001, 2000} ;
249    
250    
251  Float_t A1t[48][9] = {  Float_t A1t[48][9] = {
252  0, -0.148721, -3.39495, -4.31459, -0.929148, 3.54132, -0.781274, 1.31968, 0, 0, 0.300986, -2.80331, -4.23227, 0.298916, 4.10416, -5.18516, 7.03041, 0,  0, -0.148721, -3.39495, -4.31459, -0.929148, 3.54132, -0.781274, 1.31968, 0,
253  0, -0.590177, -3.12529, -0.44614, 0.620419, 5.19609, 9.88925, 14.9819, 0, 0, -0.173358, -3.98938, -0.616916, 0.405404,  0, 0.300986, -2.80331, -4.23227, 0.298916, 4.10416, -5.18516, 7.03041, 0,
254  6.25045, 10.5087, 24.7055, 0, 0, -0.32707, -1.1686, -3.46701, -0.284242, 4.09514, -0.561233, -0.166844, 0, 0, 0.0440221, -1.5147, -2.67239,  0, -0.590177, -3.12529, -0.44614, 0.620419, 5.19609, 9.88925, 14.9819, 0,
255  -1.08848, 5.05632, 3.92546, -0.0525454, 0, 0, -0.331836, -1.25371, -1.59317, 0.654738, 4.41673, 5.99879,  0, -0.173358, -3.98938, -0.616916, 0.405404, 6.25045, 10.5087, 24.7055, 0,
256  14.9057, 0, 0, 0.00587183, -2.17841, -1.48496, 0.477997, 6.24062, 6.19841, 11.4798, 0, 0, -0.515989, -2.1195, -1.44376, 0.145546, 5.41926,  0, -0.32707, -1.1686, -3.46701, -0.284242, 4.09514, -0.561233, -0.166844, 0,
257  5.03587, 10.7126, 0, 0, 0, 0, -0.5, 0, 4.35377, 6.97709, 15.0047, 0, 0, -0.554732, -1.6306, -1.54677,  0, 0.0440221, -1.5147, -2.67239, -1.08848, 5.05632, 3.92546, -0.0525454, 0,
258  0.687092, 3.97612, 4.05449, 3.44324, 0, 0, -0.0314164, -2.83515, -1.29946, 2.31597, 7.15645, 6.95353, 12.8573, 0, 0, -0.218413, -3.04095, -1.50327,  0, -0.331836, -1.25371, -1.59317, 0.654738, 4.41673, 5.99879, 14.9057, 0,
259  0.291698, 5.27119, 9.06051, 18.4417, 0, 0, 0.410005, -2.45452, -0.851601, 0.206665, 6.44906, 7.53132,  0, 0.00587183, -2.17841, -1.48496, 0.477997, 6.24062, 6.19841, 11.4798, 0,
260  10.5636, 0, 0, -1.29063, 0.463767, -0.720394, 1.27269, 3.66394, 4.52102, 7.33444, 0, 0, -1.54073, -1.60146, -1.91721, -0.640132, 3.58881, 0.561348,  0, -0.515989, -2.1195, -1.44376, 0.145546, 5.41926, 5.03587, 10.7126, 0,
261  7.33444, 0, 0, -0.558527, -2.43481, -1.64492, 1.51694, 6.05449, 4.67951, 5.40004, 0, 0, -1.44736, -5.265, -1.28878, -0.238869, 4.13668, 4.58264,  0, 0, 0.0682, 3.2814, -6.1989, 8.05589, 9.75967, 23.797, 0,
262  3.28758, 0, 0, -0.596315, -3.35555, -2.03624, -0.148223, 6.16332, 4.71164, 15.6531, 0, 0, -0.740826, -4.79843, 0.345734, -0.210722, 6.32702, 9.76698, 19.9151, 0, 0, -0.541817,  0, -0.554732, -1.6306, -1.54677, 0.687092, 3.97612, 4.05449, 3.44324, 0,
263  -3.30557, -1.76057, -0.216039, 5.79923, 8.00931, 16.4061, 0, 0, -0.0503124, -2.66635, -1.70196, -1.07446, 3.46058, 1.45824,  0, -0.0314164, -2.83515, -1.29946, 2.31597, 7.15645, 6.95353, 12.8573, 0,
264  -2.21932, 0, 0, -0.495955, -5.78012, -0.174017, 0.675206, 6.30264, 8.30058, 20.3899, 0, 0, -0.315843, -2.8796, -3.04323, -0.681945, 5.49248, 7.42757,  0, -0.218413, -3.04095, -1.50327, 0.291698, 5.27119, 9.06051, 18.4417, 0,
265  17.1667, 0, 0, -0.643179, -3.5364, -0.245549, 0.694213, 5.79727, 10.2911, 9.61651, 0, 0, -0.315433, -3.56856, -1.25894, 2.05501, 6.85829, 8.74895,  0, 0.410005, -2.45452, -0.851601, 0.206665, 6.44906, 7.53132, 10.5636, 0,
266  14.9955, 0, 0, -0.478207, -4.82517, 0.688668, 1.40183, 6.78743, 8.02806, 2.65821, 0, 0, -1.63072, -5.05269, -0.582789, 1.22014, 6.80023, 8.8931, 5.15517, 0, 0,  0, -1.29063, 0.463767, -0.720394, 1.27269, 3.66394, 4.52102, 7.33444, 0,
267  -1.50826, -3.68958, 0.420744, 3.25124, 4.28046, -16.9712, -12, 0, 0, -1.52021, -3.37459, -2.41086, 0.547517, -0.56013, -8.59935, -3, 0, 0, -0.998702, -4.7187, -2.33974,  0, -1.54073, -1.60146, -1.91721, -0.640132, 3.58881, 0.561348, 7.33444, 0,
268  -0.0974348, 3.10138, 2.3293, -5.71135, 0, 0, -1.66188, -2.39145, -2.55052, 0.29005, -0.16697, -3.97018, -1.5, 0, 0,  0, -0.558527, -2.43481, -1.64492, 1.51694, 6.05449, 4.67951, 5.40004, 0,
269  -2.04431, -4.95214, -1.51889, 1.92081, 5.92476, 8.94417, -0.172422, 0, 0, -1.94155, -4.95644, -2.47063, 0.0233995, 2.57015, 4.84173,  0, -1.44736, -5.265, -1.28878, -0.238869, 4.13668, 4.58264, 3.28758, 0,
270  -0.555407, 0, 0, -2.22045, -4.21875, -1.23892, 0.911188, -0.705415, -11.5648, -7, 0, 0, -2.25418, -3.71067,  0, -0.596315, -3.35555, -2.03624, -0.148223, 6.16332, 4.71164, 15.6531, 0,
271  -1.87307, 0.560423, 0.206679, -4.27293, -3, 0, 0, -3.90179, -5.14354, -4.08454, -3.13545, -3.57868, -5.13198, -1.0019, 0, 0, -3.78789, -4.50313,  0, -0.740826, -4.79843, 0.345734, -0.210722, 6.32702, 9.76698, 19.9151, 0,
272  -5.24307, -3.24931, -0.319336, -1.407, -3.77821, 0, 0, -4.16337, -7.12861, -2.29639, -0.786276, 2.58494, 4.16162, 7.22747, 0, 0, -4.04189, -7.82707,  0, -0.541817, -3.30557, -1.76057, -0.216039, 5.79923, 8.00931, 16.4061, 0,
273  -1.34893, -1.05519, 4.33166, 4.87264, 12.3328, 0, 0, -3.85946, -5.71064, -4.43564, -1.53025, 1.42505, -0.0695653, 4.33418, 0, 0, -3.65794, -8.19828,  0, -0.0503124, -2.66635, -1.70196, -1.07446, 3.46058, 1.45824, -2.21932, 0,
274  -3.32738, -1.25785, -1.13124, -6.79745, -8.37113, 0, 0, -5.571, -2.49596, -2.8623, -2.74219, -1.43215, -0.359863, 0.25062, 0, 0, -6.00932, -5.60393,  0, -0.495955, -5.78012, -0.174017, 0.675206, 6.30264, 8.30058, 20.3899, 0,
275  -2.33967, -1.53792, 3.67721, 5.49137, 8.34507, 0, 0, -5.36442, -3.19657, -2.9975, -1.73078, 0.0558693, -0.179221, 9.45231, 0, 0, -5.91858, -5.04606, -2.88549, -0.953526, 1.17816, 5.43427, 0.871257, 0,  0, -0.315843, -2.8796, -3.04323, -0.681945, 5.49248, 7.42757, 17.1667, 0,
276  0, -5.53832, -0.498886, -3.85789, -2.61557, -2.45863, -1.44554, -7.21927, 0, 0, -5.70059, -3.94476, -3.23927, 0.15573, 1.85295, 3.96162, 8.70362, 0 } ;  0, -0.643179, -3.5364, -0.245549, 0.694213, 5.79727, 10.2911, 9.61651, 0,
277    0, -0.315433, -3.56856, -1.25894, 2.05501, 6.85829, 8.74895, 14.9955, 0,
278    0, -0.478207, -4.82517, 0.688668, 1.40183, 6.78743, 8.02806, 2.65821, 0,
279    0, -1.63072, -5.05269, -0.582789, 1.22014, 6.80023, 8.8931, 5.15517, 0,
280    0, -1.50826, -3.68958, 0.420744, 3.25124, 4.28046, -16.9712, -12, 0,
281    0, -1.52021, -3.37459, -2.41086, 0.547517, -0.56013, -8.59935, -3, 0,
282    0, -0.998702, -4.7187, -2.33974, -0.0974348, 3.10138, 2.3293, -5.71135, 0,
283    0, -1.66188, -2.39145, -2.55052, 0.29005, -0.16697, -3.97018, -1.5, 0,
284    0, -2.04431, -4.95214, -1.51889, 1.92081, 5.92476, 8.94417, -0.172422, 0,
285    0, -1.94155, -4.95644, -2.47063, 0.0233995, 2.57015, 4.84173, -0.555407, 0,
286    0, -2.22045, -4.21875, -1.23892, 0.911188, -0.705415, -11.5648, -7, 0,
287    0, -2.25418, -3.71067, -1.87307, 0.560423, 0.206679, -4.27293, -3, 0,
288    0, -3.90179, -5.14354, -4.08454, -3.13545, -3.57868, -5.13198, -1.0019, 0,
289    0, -3.78789, -4.50313, -5.24307, -3.24931, -0.319336, -1.407, -3.77821, 0,
290    0, -4.16337, -7.12861, -2.29639, -0.786276, 2.58494, 4.16162, 7.22747, 0,
291    0, -4.04189, -7.82707, -1.34893, -1.05519, 4.33166, 4.87264, 12.3328, 0,
292    0, -3.85946, -5.71064, -4.43564, -1.53025, 1.42505, -0.0695653, 4.33418, 0,
293    0, -3.65794, -8.19828, -3.32738, -1.25785, -1.13124, -6.79745, -8.37113, 0,
294    0, -5.571, -2.49596, -2.8623, -2.74219, -1.43215, -0.359863, 0.25062, 0,
295    0, -6.00932, -5.60393, -2.33967, -1.53792, 3.67721, 5.49137, 8.34507, 0,
296    0, -5.36442, -3.19657, -2.9975, -1.73078, 0.0558693, -0.179221, 9.45231, 0,
297    0, -5.91858, -5.04606, -2.88549, -0.953526, 1.17816, 5.43427, 0.871257, 0,
298    0, -5.53832, -0.498886, -3.85789, -2.61557, -2.45863, -1.44554, -7.21927, 0,
299    0, -5.70059, -3.94476, -3.23927, 0.15573, 1.85295, 3.96162, 8.70362, 0 };
300    
301    
302  Float_t A2t[48][9] = {  Float_t A2t[48][9] = {
303  0, 0.447567, 2.19777, 4.56362, 2.7416, 2.05411, 10.11, 19.0312, 0, 0, 0.11417, 1.62292, 5.00684, 3,  0, 0.447567, 2.19777, 4.56362, 2.7416, 2.05411, 10.11, 19.0312, 0,
304  3.00006, 17.3401, 17.8502, 0, 0, 0.613665, 1.84729, 0.717669, 3, 2.53701, 1.23897, 10.2529, 0, 0, 0.318447, 2.30647, 0.936633, 3, 3, 2.95973, 3, 0, 0,  0, 0.11417, 1.62292, 5.00684, 3, 3.00006, 17.3401, 17.8502, 0,
305  0.398201, 0.701095, 3.91236, 3, 3, 11.5693, 17.9749, 0, 0, 0.202853, 0.806934, 3.11779, 3.57657, 1.59933,  0, 0.613665, 1.84729, 0.717669, 3, 2.53701, 1.23897, 10.2529, 0,
306  6.71492, 23.6721, 0, 0, 0.378081, 0.60131, 1.91722, 1.97014, 3, 5.08036, 9.64776, 0, 0, 0.185602, 1.13243, 1.95726, 2.25608, 1.31382,  0, 0.318447, 2.30647, 0.936633, 3, 3, 2.95973, 3, 0,
307  6.06097, 15.9104, 0, 0, 0.519026, 1.16139, 1.92471, 3, 3, 6.24901, 15.0465, 0, 0, 0, 0, 0, 0, 3, 1.24657,  0, 0.398201, 0.701095, 3.91236, 3, 3, 11.5693, 17.9749, 0,
308  0.76179, 0, 0, 0.584808, 1.01299, 1.55521, 1.3038, 3, 7.23646, 20.977, 0, 0, 0.252569, 1.60163, 1.83587, 0.630466, 0.777058, 6.0142, 15.4738, 0, 0,  0, 0.202853, 0.806934, 3.11779, 3.57657, 1.59933, 6.71492, 23.6721, 0,
309  0.434331, 1.84922, 1.83168, 3, 3, 3, 6.44375, 0, 0, 0.0330463, 1.50249, 1.15961, 3, 0.810556, 4.20175,  0, 0.378081, 0.60131, 1.91722, 1.97014, 3, 5.08036, 9.64776, 0,
310  16.0172, 0, 0, 1.15272, -0.461141, 0.6358, 0.566375, 3.20343, 5.26698, 14.6336, 0, 0, 1.24677, 1.12736, 1.76074, 3, 3.77723, 10.7814, 14.6336, 0,  0, 0.185602, 1.13243, 1.95726, 2.25608, 1.31382, 6.06097, 15.9104, 0,
311  0, 0.551726, 1.59633, 1.18411, 0.119382, 0.843864, 6.67491, 20.4289, 0, 0, 1.17008, 3.53223, 1.7298, 3,  0, 0.519026, 1.16139, 1.92471, 3, 3, 6.24901, 15.0465, 0,
312  3.51043, 7.10543, 22.3253, 0, 0, 0.612142, 1.96606, 2.64693, 3.25016, 1.25888, 7.04821, 11.7283, 0, 0, 0.69148, 2.84536, 0.249509, 4.29848, 3,  0, 0, 0, -1.972, 4.7828, -3.1154, -2.11319, -4.7497, 0,
313  3.58229, 9.01681, 0, 0, 0.565678, 1.96366, 2.32387, 3.15843, 1.66386, 3.07223, 7.67847, 0, 0, 0.286252,  0, 0.584808, 1.01299, 1.55521, 1.3038, 3, 7.23646, 20.977, 0,
314  1.61749, 2.08437, 3.96745, 3.46972, 9.29207, 23.9444, 0, 0, 0.427677, 3.58328, 0.303785, 3, 3, 4.66547, 6.77271, 0, 0, 0.367136, 1.62323,  0, 0.252569, 1.60163, 1.83587, 0.630466, 0.777058, 6.0142, 15.4738, 0,
315  3.53394, 3.22174, 1.19152, 2.67962, 7.37085, 0, 0, 0.571177, 2.03267, 0.714761, 2.31548, 3, 3, 23.2035, 0,  0, 0.434331, 1.84922, 1.83168, 3, 3, 3, 6.44375, 0,
316  0, 0.410871, 2.02075, 2.01824, 1.2684, 1.18522, 3.21976, 12.8378, 0, 0, 0.463877, 2.86112, 0.170916, 3, 3, 5.97413, 28.4085, 0, 0, 1.30088,  0, 0.0330463, 1.50249, 1.15961, 3, 0.810556, 4.20175, 16.0172, 0,
317  3.26557, 2, 3, 3, 4.77584, 22.8794, 0, 0, 1.02941, 2.12558, 0.872765, 2.23727, 4.7981, 24.6338, 24.6338, 0, 0, 1.05783, 1.89525, 2.85289, 3.0898,  0, 1.15272, -0.461141, 0.6358, 0.566375, 3.20343, 5.26698, 14.6336, 0,
318  7.83407, 17.8466, 20, 0, 0, 0.87851, 2.49044, 1.91387, 2.41541, 3.8418, 9.41288, 24.0375, 0, 0, 1.18188, 1.273, 2.9275, 3.06704, 7.12642, 12.7629, 15,  0, 1.24677, 1.12736, 1.76074, 3, 3.77723, 10.7814, 14.6336, 0,
319  0, 0, 1.53682, 2.57011, 1.06205, 0.506326, 1.68314, 3.58498, 23.1595, 0, 0, 1.46302, 2.68515, 1.99381, 2.17816, 4.41356, 6.53634,  0, 0.551726, 1.59633, 1.18411, 0.119382, 0.843864, 6.67491, 20.4289, 0,
320  20.7136, 0, 0, 1.4731, 2.3654, 1.53025, 2.96327, 8.70277, 21.6253, 25, 0, 0, 1.53808, 2.07089, 2.22662, 3.14766, 7.57131, 14.2471, 20, 0, 0,  0, 1.17008, 3.53223, 1.7298, 3, 3.51043, 7.10543, 22.3253, 0,
321  2.54185, 2.94079, 2.66362, 3.52374, 6.80629, 11.3325, 14.5186, 0, 0, 2.43664, 2.49436, 4.17446, 3.77162,  0, 0.612142, 1.96606, 2.64693, 3.25016, 1.25888, 7.04821, 11.7283, 0,
322  3.31898, 7.43896, 18.2548, 0, 0, 2.66465, 3.9858, 1.0855, 1.91916, 1.82719, 3.62289, 11.3872, 0, 0, 2.59071, 4.39003, 0.0757547, 3, 0.158868,  0, 0.69148, 2.84536, 0.249509, 4.29848, 3, 3.58229, 9.01681, 0,
323  3.55454, 5.71387, 0, 0, 2.48014, 3.16071, 3.1975, 1.7259, 1.53532, 6.33812, 11.2325, 0, 0, 2.35236,  0, 0.565678, 1.96366, 2.32387, 3.15843, 1.66386, 3.07223, 7.67847, 0,
324  4.94998, 1.78836, 1.9115, 4.74233, 13.6973, 21.965, 0, 0, 3.52215, 0.812087, 1.1768, 2.95239, 4.3202, 6.04614, 13.6556, 0, 0, 3.79446, 2.80606,  0, 0.286252, 1.61749, 2.08437, 3.96745, 3.46972, 9.29207, 23.9444, 0,
325  0.88371, 3, 0.614106, 2.52782, 12.4441, 0, 0, 3.41363, 1.57296, 1.59021, 2.47593, 3.41146, 6.76304, 5.59471, 0, 0, 3.72529, 2.50889, 2, 3, 4.06815, 2.78676,  0, 0.427677, 3.58328, 0.303785, 3, 3, 4.66547, 6.77271, 0,
326  19.6427, 0, 0, 3.54713, -0.296079, 2.10851, 2.42037, 5.37573, 6.78065, 22.298, 0, 0, 3.61517, 1.96909, 2, 0.249865, 2.46639, 3.42483, 8.1652, 0 } ;  0, 0.367136, 1.62323, 3.53394, 3.22174, 1.19152, 2.67962, 7.37085, 0,
327    0, 0.571177, 2.03267, 0.714761, 2.31548, 3, 3, 23.2035, 0,
328    0, 0.410871, 2.02075, 2.01824, 1.2684, 1.18522, 3.21976, 12.8378, 0,
329    0, 0.463877, 2.86112, 0.170916, 3, 3, 5.97413, 28.4085, 0,
330    0, 1.30088, 3.26557, 2, 3, 3, 4.77584, 22.8794, 0,
331    0, 1.02941, 2.12558, 0.872765, 2.23727, 4.7981, 24.6338, 24.6338, 0,
332    0, 1.05783, 1.89525, 2.85289, 3.0898, 7.83407, 17.8466, 20, 0,
333    0, 0.87851, 2.49044, 1.91387, 2.41541, 3.8418, 9.41288, 24.0375, 0,
334    0, 1.18188, 1.273, 2.9275, 3.06704, 7.12642, 12.7629, 15, 0,
335    0, 1.53682, 2.57011, 1.06205, 0.506326, 1.68314, 3.58498, 23.1595, 0,
336    0, 1.46302, 2.68515, 1.99381, 2.17816, 4.41356, 6.53634, 20.7136, 0,
337    0, 1.4731, 2.3654, 1.53025, 2.96327, 8.70277, 21.6253, 25, 0,
338    0, 1.53808, 2.07089, 2.22662, 3.14766, 7.57131, 14.2471, 20, 0,
339    0, 2.54185, 2.94079, 2.66362, 3.52374, 6.80629, 11.3325, 14.5186, 0,
340    0, 2.43664, 2.49436, 4.17446, 3.77162, 3.31898, 7.43896, 18.2548, 0,
341    0, 2.66465, 3.9858, 1.0855, 1.91916, 1.82719, 3.62289, 11.3872, 0,
342    0, 2.59071, 4.39003, 0.0757547, 3, 0.158868, 3.55454, 5.71387, 0,
343    0, 2.48014, 3.16071, 3.1975, 1.7259, 1.53532, 6.33812, 11.2325, 0,
344    0, 2.35236, 4.94998, 1.78836, 1.9115, 4.74233, 13.6973, 21.965, 0,
345    0, 3.52215, 0.812087, 1.1768, 2.95239, 4.3202, 6.04614, 13.6556, 0,
346    0, 3.79446, 2.80606, 0.88371, 3, 0.614106, 2.52782, 12.4441, 0,
347    0, 3.41363, 1.57296, 1.59021, 2.47593, 3.41146, 6.76304, 5.59471, 0,
348    0, 3.72529, 2.50889, 2, 3, 4.06815, 2.78676, 19.6427, 0,
349    0, 3.54713, -0.296079, 2.10851, 2.42037, 5.37573, 6.78065, 22.298, 0,
350    0, 3.61517, 1.96909, 2, 0.249865, 2.46639, 3.42483, 8.1652, 0} ;
351    
352    
353  // S115B failure: 1158700000 // 2006-09-19 21:06:40 UTC  // S115B failure: 1158700000 // 2006-09-19 21:06:40 UTC
354    
355  if (time > 1158700000.) {     // first workaround: just use calibration of PMT S115A  if (time < 1158700000.) {     // first workaround: just use calibration of PMT S115A
356  for ( Int_t jj=0; jj<9; jj++ ){  for ( Int_t jj=0; jj<9; jj++ ){
357  A0t[9][jj] = A0t[8][jj] ;  A0t[9][jj] = A0t[8][jj] ;
358  A1t[9][jj] = A1t[8][jj] ;  A1t[9][jj] = A1t[8][jj] ;
# Line 223  Float_t xv[6],yv[6]; Line 374  Float_t xv[6],yv[6];
374  Int_t  iz;  Int_t  iz;
375  Float_t x1[9],y1[9];  Float_t x1[9],y1[9];
376  Int_t n1 = 9;  Int_t n1 = 9;
377  Float_t  Layercharge[6] = {1000., 1000., 1000., 1000., 1000., 1000. };  
378    Float_t  Layercharge[6] = {1005., 1005., 1005., 1005., 1005., 1005. };
379    
380  Int_t  Layerinfo[6] = {0, 0, 0, 0, 0, 0 };  Int_t  Layerinfo[6] = {0, 0, 0, 0, 0, 0 };
381    
382    Float_t adc[48],adc_c[48],PMTcharge_arr[48];
383    
384  //------------------------------------------------------------------  //------------------------------------------------------------------
385    
386  PamTrack *track = L2->GetTrack(0);  PamTrack *track = L2->GetTrack(0);
387    
388  Float_t beta_mean = fabs(track->GetToFTrack()->beta[12]);  Float_t beta_mean = fabs(track->GetToFTrack()->beta[12]);
389    
390    // New!! If "beta_in" != 100. then overwrite beta_mean with beta_in
391    if (beta_in != 100.) beta_mean=beta_in;
392    
393  Float_t def = track->GetTrkTrack()->al[4];  Float_t def = track->GetTrkTrack()->al[4];
394  Float_t rig = 1./def;  Float_t rig = 1./def;
395    
396  Int_t ncount=0;  Int_t ncount=0;
397  Float_t charge_chi=1000.;  Float_t charge_chi=1000.;
398    
 if ((beta_mean > 0.05)  && (beta_mean < 1.5)) {  
   
   
399  //-------------------------------------------------------------  //-------------------------------------------------------------
400  //------------------  ToF Charge ------------------------------  //------------------  ToF Charge ------------------------------
401  //-------------------------------------------------------------  //-------------------------------------------------------------
# Line 248  if ((beta_mean > 0.05)  && (beta_mean < Line 403  if ((beta_mean > 0.05)  && (beta_mean <
403  // fill adc and tdc  // fill adc and tdc
404    
405     Int_t ich,jj,kk;     Int_t ich,jj,kk;
    Float_t adc[48],adc_c[48],PMTcharge_arr[48];  
406    
407     for (ich=0; ich<48; ich++)   adc[ich]   = 4095.;     for (ich=0; ich<48; ich++)   adc[ich]   = 4095.;
408     for (ich=0; ich<48; ich++)   adc_c[ich] = 1000.;     for (ich=0; ich<48; ich++)   adc_c[ich] = 1000.;
409     for (ich=0; ich<48; ich++)   PMTcharge_arr[ich] = 1000.;     for (ich=0; ich<48; ich++)   PMTcharge_arr[ich] = 1000.;
410    
411    
412    
413    if ((beta_mean < 0.05)  || (beta_mean > 2.0)) {
414      for (Int_t jj=0; jj<48;jj++) charge_PMT_trk[jj] = 1001.;
415      for (Int_t jj=0; jj<6;jj++) charge_layer_trk[jj] = 1001.;
416      for (Int_t jj=0; jj<6;jj++) layerinfo_trk[jj] = 1001.;
417      charge_trk = 1001.;
418      ncount_trk = 0;
419                                                  }
420    
421    
422    if ((beta_mean > 0.05)  && (beta_mean < 2.0)) {
423    
424     Float_t betahelp =   pow(beta_mean, 1.2);     Float_t betahelp =   pow(beta_mean, 1.2);
425    
426  //=======================================================================  //=======================================================================
# Line 274  if ((beta_mean > 0.05)  && (beta_mean < Line 441  if ((beta_mean > 0.05)  && (beta_mean <
441            Int_t adcflag = track->GetToFTrack()->adcflag[ipmt];            Int_t adcflag = track->GetToFTrack()->adcflag[ipmt];
442            L2->GetToFLevel2()->GetPMTIndex(pmtadc,jj,kk);            L2->GetToFLevel2()->GetPMTIndex(pmtadc,jj,kk);
443            if (adcflag==0) adc_c[pmtadc] = dEdx;            if (adcflag==0) adc_c[pmtadc] = dEdx;
           if (adc[pmtadc] > PMTsat[pmtadc]) adc_c[pmtadc] = 1000.;  
444    
           cout<<pmtadc<<" "<<adc[pmtadc]<<" "<<dEdx<<" "<<adc_c[pmtadc]<<endl;  
445    
446             if (adc[pmtadc] == 4095) adc_c[pmtadc] = 0.;
447             if (adc[pmtadc] == 4095) PMTcharge_arr[pmtadc] = 0.;
448    
449             if ((adc[pmtadc]>PMTsat[pmtadc]) && (adc[pmtadc]<4095)) adc_c[pmtadc] = 1000.;
450    
451           if (adc[pmtadc] < PMTsat[pmtadc]) {           if (adc[pmtadc] < PMTsat[pmtadc]) {
452  //----------------------------------------------------------------------------------------  //----------------------------------------------------------------------------------------
# Line 296  if ((pmtadc!=1) && (pmtadc!=9) || (pmtad Line 465  if ((pmtadc!=1) && (pmtadc!=9) || (pmtad
465      spl2->Delete();      spl2->Delete();
466      PMTcharge_arr[pmtadc] = charge;      PMTcharge_arr[pmtadc] = charge;
467                                                                           } // pmtadc != ...                                                                           } // pmtadc != ...
468    
469  //----------------------------------------------------------------------------------------  //----------------------------------------------------------------------------------------
470    
471  if ((pmtadc==1) || (pmtadc==9) || (pmtadc==28) || (pmtadc==29) || (pmtadc==34)) {  if ((pmtadc==1) || (pmtadc==9) || (pmtadc==28) || (pmtadc==29) || (pmtadc==34)) {
472           for ( Int_t jj=0; jj<8; jj++ ){           for ( Int_t jj=0; jj<8; jj++ ){
473           yl = A0t[pmtadc][jj]+A1t[pmtadc][jj]*beta_mean+A2t[pmtadc][jj]*beta_mean*beta_mean;           yl = A0t[pmtadc][jj]+A1t[pmtadc][jj]*beta_mean+A2t[pmtadc][jj]*beta_mean*beta_mean;
# Line 312  if ((pmtadc==1) || (pmtadc==9) || (pmtad Line 483  if ((pmtadc==1) || (pmtadc==9) || (pmtad
483                                                                            } // if pmtadc ==....                                                                            } // if pmtadc ==....
484  //----------------------------------------------------------------------------------------  //----------------------------------------------------------------------------------------
485                                         } // adc < sat                                         } // adc < sat
486    
487               }   // ipmt...               }   // ipmt...
488    
489  //====================================================================  //====================================================================
# Line 339  Int_t ihelp_a[6] = {0,16,28,32,36,42}; Line 511  Int_t ihelp_a[6] = {0,16,28,32,36,42};
511    
512  for (Int_t ilay=0; ilay<6; ilay ++) {  for (Int_t ilay=0; ilay<6; ilay ++) {
513  Int_t jj = PaddleIdOfTrack[ilay] ;  Int_t jj = PaddleIdOfTrack[ilay] ;
514  Float_t xhelp = 1000.;  //Float_t xhelp = 1000.;
515    Float_t xhelp = 1005.;
516    
517  if (jj == -1) Layerinfo[ilay] = -1;  if (jj == -1) Layerinfo[ilay] = -1;
518    
# Line 353  if ((PMTcharge_arr[ih]==1000.) && (PMTch Line 526  if ((PMTcharge_arr[ih]==1000.) && (PMTch
526     if (adc[ih+1] ==  4095) Layerinfo[ilay] = Layerinfo[ilay] + 1;     if (adc[ih+1] ==  4095) Layerinfo[ilay] = Layerinfo[ilay] + 1;
527     if ((adc[ih] > PMTsat[ih]) && (adc[ih] < 4095)) Layerinfo[ilay] = Layerinfo[ilay] + 10;     if ((adc[ih] > PMTsat[ih]) && (adc[ih] < 4095)) Layerinfo[ilay] = Layerinfo[ilay] + 10;
528     if ((adc[ih+1] > PMTsat[ih+1]) && (adc[ih+1] < 4095)) Layerinfo[ilay] = Layerinfo[ilay] + 10;     if ((adc[ih+1] > PMTsat[ih+1]) && (adc[ih+1] < 4095)) Layerinfo[ilay] = Layerinfo[ilay] + 10;
 //   cout<<ilay<<" "<<jj<<" "<<Layerinfo[ilay]<<endl;  
   
529         }         }
530  Layercharge[ilay] = xhelp;  Layercharge[ilay] = xhelp;
531                                      } // ilay ...                                      } // ilay ...
532    
533    
 //cout<<"Trk : ";  
 //for (Int_t ilay=0; ilay<6; ilay ++) cout<<Layercharge[ilay]<<" ";  
534    
535  //==========================================================================  //==========================================================================
536  //=========================   2nd-order correction   =======================  //=========================   2nd-order correction   =======================
# Line 388  Layercharge[ii] = Layercharge[ii]/c_corr Line 557  Layercharge[ii] = Layercharge[ii]/c_corr
557  //==========================================================================  //==========================================================================
558  //==========================================================================  //==========================================================================
559    
560    
561  Int_t  icount=0;  Int_t  icount=0;
562  Float_t charge_mean = 0.;  Float_t charge_mean = 0.;
563  for (Int_t ii=0; ii<6;  ii++) {  for (Int_t ii=0; ii<6;  ii++) {
# Line 461  if (icount>0) { Line 631  if (icount>0) {
631  //  cout<<" => "<<icount<<" "<<charge_chi<<endl;  //  cout<<" => "<<icount<<" "<<charge_chi<<endl;
632    
633  //=============================================================  //=============================================================
634    // changed 30-01-2009 WM
635    
636      for (Int_t jj=0; jj<48;jj++) charge_PMT_trk[jj] = PMTcharge_arr[jj];
 } // 0.05 < beta < 1.5  
   
637    for (Int_t jj=0; jj<6;jj++) charge_layer_trk[jj] = Layercharge[jj];    for (Int_t jj=0; jj<6;jj++) charge_layer_trk[jj] = Layercharge[jj];
638    for (Int_t jj=0; jj<6;jj++) layerinfo_trk[jj] = Layerinfo[jj];    for (Int_t jj=0; jj<6;jj++) layerinfo_trk[jj] = Layerinfo[jj];
639    charge_trk = charge_chi;    charge_trk = charge_chi;
640    ncount_trk = ncount;    ncount_trk = ncount;
641    
642    } // 0.05 < beta < 2.0
643    
644  } // if ntrk == 1  } // if ntrk == 1
645    
646  //================================================================  //================================================================
# Line 482  if (icount>0) { Line 653  if (icount>0) {
653  //  if(!track)return;  //  if(!track)return;
654    if(track) {    if(track) {
655    
656    /*
657  Float_t  PMTsat[48] = {  Float_t  PMTsat[48] = {
658  3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37, 3130.05, 3087.07, 3112.22,  3162.14, 3165.48, 3153.85, 3085.73, 3089.65, 3107.64, 3097.52, 3078.37, 3130.05, 3087.07, 3112.22,
659  3102.92, 3080.58, 3092.55, 3087.94, 3125.03, 3094.09, 3143.16,  3102.92, 3080.58, 3092.55, 3087.94, 3125.03, 3094.09, 3143.16,
# Line 489  Float_t  PMTsat[48] = { Line 661  Float_t  PMTsat[48] = {
661  3097.99, 3033.84, 3134.98, 3081.37, 3111.04, 3066.77, 3108.17,  3097.99, 3033.84, 3134.98, 3081.37, 3111.04, 3066.77, 3108.17,
662  3133, 3111.06, 3052.52, 3140.66, 3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11  3133, 3111.06, 3052.52, 3140.66, 3106.33, 3094.85, 3150.85, 3118.8, 3096.24, 3118.47,3111.36, 3117.11
663  };  };
664    */
665    
666    // new values from Napoli dec 2008
667    Float_t  PMTsat[48] = {
668    3176.35,3178.19,3167.38,3099.73,3117.00,3126.29,3111.44,3092.27,
669    3146.48,3094.41,3132.13,3115.37,3099.32,3110.97,3111.80,3143.14,
670    3106.72,3153.44,3136.00,3188.96,3104.73,3140.45,3073.18,3106.62,
671    3112.48,3146.92,3127.24,3136.52,3109.59,3112.89,3045.15,3147.26,
672    3095.92,3121.05,3083.25,3123.62,3150.92,3125.30,3067.60,3160.18,
673    3119.36,3108.92,3164.77,3133.64,3111.47,3131.98,3128.87,3135.56 };
674    
675    for (Int_t i=0; i<48;i++) PMTsat[i] = PMTsat[i] - 5.;  // safety margin
676    
677    
678  Float_t C0t[48][9] = {  Float_t C0t[48][9] = {
679  0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,  0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92, 0, 1, 2, 3, 4, 5, 6, 8, 92,
# Line 618  Float_t A2t[48][9] = { Line 803  Float_t A2t[48][9] = {
803    
804  // S115B failure: 1158700000 // 2006-09-19 21:06:40 UTC  // S115B failure: 1158700000 // 2006-09-19 21:06:40 UTC
805    
806  if (time > 1158700000.) {     // first workaround: just use calibration of PMT S115A  if (time < 1158700000.) {     // first workaround: just use calibration of PMT S115A
807  for ( Int_t jj=0; jj<9; jj++ ){  for ( Int_t jj=0; jj<9; jj++ ){
808  A0t[9][jj] = A0t[8][jj] ;  A0t[9][jj] = A0t[8][jj] ;
809  A1t[9][jj] = A1t[8][jj] ;  A1t[9][jj] = A1t[8][jj] ;
# Line 641  Int_t  iz; Line 826  Int_t  iz;
826  Float_t x1[9],y1[9];  Float_t x1[9],y1[9];
827  Int_t n1 = 9;  Int_t n1 = 9;
828    
829  Float_t  Layercharge[6] = {1000., 1000., 1000., 1000., 1000., 1000. };  Float_t  Layercharge[6] = {1005., 1005., 1005., 1005., 1005., 1005. };
830    
831  Int_t  Layerinfo[6] = {0, 0, 0, 0, 0, 0 };  Int_t  Layerinfo[6] = {0, 0, 0, 0, 0, 0 };
832    
833    Float_t adc[48],adc_c[48],PMTcharge_arr[48];
834    
835    Float_t beta_mean = fabs(track->beta[12]);
836    
837    Float_t beta_mean = fabs(track->beta[12]);  // New!! If "beta_in" != 100. then overwrite beta_mean with beta_in
838    if (beta_in != 100.) beta_mean=beta_in;
839    
840    Int_t ncount=0;    Int_t ncount=0;
841    Float_t charge_chi=1000.;    Float_t charge_chi=1000.;
842    
   if ((beta_mean > 0.05)  && (beta_mean < 1.5)) {  
843        
844  //-------------------------------------------------------------  //-------------------------------------------------------------
845    
846  // fill adc and tdc  // fill adc and tdc
847    
848     Int_t ich,jj,kk;     Int_t ich,jj,kk;
    Float_t adc[48],adc_c[48],PMTcharge_arr[48];  
849    
850     for (ich=0; ich<48; ich++)   adc[ich]   = 4095.;     for (ich=0; ich<48; ich++)   adc[ich]   = 4095.;
851     for (ich=0; ich<48; ich++)   adc_c[ich] = 1000.;     for (ich=0; ich<48; ich++)   adc_c[ich] = 1000.;
852     for (ich=0; ich<48; ich++)   PMTcharge_arr[ich] = 1000.;     for (ich=0; ich<48; ich++)   PMTcharge_arr[ich] = 1000.;
853    
854    
855    if ((beta_mean < 0.05)  || (beta_mean > 2.0)) {
856      for (Int_t jj=0; jj<48;jj++) charge_PMT_std[jj] = 1001.;
857      for (Int_t jj=0; jj<6;jj++) charge_layer_std[jj] = 1001.;
858      for (Int_t jj=0; jj<6;jj++) layerinfo_std[jj] = 1001.;
859      charge_std = 1001.;
860      ncount_std = 0;
861                                                  }
862    
863    
864      if ((beta_mean > 0.05)  && (beta_mean < 2.0)) {
865    
866     Float_t betahelp =   pow(beta_mean, 1.2);     Float_t betahelp =   pow(beta_mean, 1.2);
867    
868  //=======================================================================  //=======================================================================
# Line 685  Int_t  Layerinfo[6] = {0, 0, 0, 0, 0, 0 Line 885  Int_t  Layerinfo[6] = {0, 0, 0, 0, 0, 0
885            Int_t adcflag = track->adcflag[ipmt];            Int_t adcflag = track->adcflag[ipmt];
886            L2->GetToFLevel2()->GetPMTIndex(pmtadc,jj,kk);            L2->GetToFLevel2()->GetPMTIndex(pmtadc,jj,kk);
887            if (adcflag==0) adc_c[pmtadc] = dEdx;            if (adcflag==0) adc_c[pmtadc] = dEdx;
888            if (adc[pmtadc] > PMTsat[pmtadc]) adc_c[pmtadc] = 1000.;  
889             if (adc[pmtadc] == 4095) adc_c[pmtadc] = 0.;
890             if (adc[pmtadc] == 4095) PMTcharge_arr[pmtadc] = 0.;
891    
892             if ((adc[pmtadc]>PMTsat[pmtadc]) && (adc[pmtadc]<4095)) adc_c[pmtadc] = 1000.;
893                                                                                    
894           if (adc[pmtadc] < PMTsat[pmtadc]) {           if (adc[pmtadc] < PMTsat[pmtadc]) {
895    
# Line 768  Int_t ihelp_a[6] = {0,16,28,32,36,42}; Line 972  Int_t ihelp_a[6] = {0,16,28,32,36,42};
972    
973  for (Int_t ilay=0; ilay<6; ilay ++) {  for (Int_t ilay=0; ilay<6; ilay ++) {
974  Int_t jj = PaddleIdOfTrack[ilay] ;  Int_t jj = PaddleIdOfTrack[ilay] ;
975  Float_t xhelp = 1000.;  //Float_t xhelp = 1000.;
976    Float_t xhelp = 1005.;
977    
978  if (jj == -1) Layerinfo[ilay] = -1;  if (jj == -1) Layerinfo[ilay] = -1;
979    
# Line 801  Float_t xb = beta_mean; Line 1006  Float_t xb = beta_mean;
1006  for (Int_t ii=0; ii<6;  ii++) {  for (Int_t ii=0; ii<6;  ii++) {
1007  Int_t ic = 0;  Int_t ic = 0;
1008  Float_t corr[4] = {1., 0., 0., 0.};  Float_t corr[4] = {1., 0., 0., 0.};
1009  for (Int_t iii=1; iii<9;  iii++) if (fabs(Layercharge[ii] - iii)<0.50) ic = iii;  //for (Int_t iii=1; iii<9;  iii++) if (fabs(Layercharge[ii] - iii)<0.50) ic = iii;
1010    for (Int_t iii=1; iii<10;  iii++) if (fabs(Layercharge[ii] - iii)<0.50) ic = iii;
1011  if ((ic>0)&&(ic<=5)) for (Int_t iii=0; iii<4;  iii++) corr[iii] = corr_a[ic-1][iii];  if ((ic>0)&&(ic<=5)) for (Int_t iii=0; iii<4;  iii++) corr[iii] = corr_a[ic-1][iii];
1012  if (ic >5) for (Int_t iii=0; iii<4;  iii++) corr[iii] = corr_a[5][iii];  if (ic >5) for (Int_t iii=0; iii<4;  iii++) corr[iii] = corr_a[5][iii];
1013    
# Line 810  Float_t c_corr = corr[0]+corr[1]*xb+corr Line 1016  Float_t c_corr = corr[0]+corr[1]*xb+corr
1016  if ((ic>0)&&(ic<=5)) c_corr = c_corr/(1.*ic) ;  if ((ic>0)&&(ic<=5)) c_corr = c_corr/(1.*ic) ;
1017  if (ic>5) c_corr = c_corr/6. ;  if (ic>5) c_corr = c_corr/6. ;
1018    
1019    //cout<<Layercharge[ii]<<" "<<ic<<" "<<c_corr<<" => ";
1020  Layercharge[ii] = Layercharge[ii]/c_corr;  Layercharge[ii] = Layercharge[ii]/c_corr;
1021    //cout<<Layercharge[ii]<<endl;
1022    
1023                              }                              }
1024    
1025    
1026  //==========================================================================  //==========================================================================
1027    //cout<<"In ToFNuclei Std: ";
1028    //for (Int_t ilay=0; ilay<6; ilay ++) cout<<Layercharge[ilay]<<" ";
1029    //cout<<endl;
1030  //==========================================================================  //==========================================================================
1031    
1032    
   
1033  Int_t  icount=0;  Int_t  icount=0;
1034  Float_t charge_mean = 0.;  Float_t charge_mean = 0.;
1035  for (Int_t ii=0; ii<6;  ii++) {  for (Int_t ii=0; ii<6;  ii++) {
# Line 827  if (Layercharge[ii] < 1000) icount++; Line 1038  if (Layercharge[ii] < 1000) icount++;
1038                              }                              }
1039  if (icount>0) charge_mean = charge_mean/(1.*icount) ;  if (icount>0) charge_mean = charge_mean/(1.*icount) ;
1040    
1041    if (icount>0) {
1042    
1043    //for (Int_t ii=0; ii<6;  ii++) cout<<Layercharge[ii]<<" ";
1044    //cout<<endl;
1045    
1046    
1047      vector<float> charge_v;
1048      Float_t charge_median = 0.;
1049    
1050      ////////  get the median charge ////////////
1051      for(Int_t ii=0;ii<6;ii++) {
1052      if (Layercharge[ii] < 1000) charge_v.push_back(Layercharge[ii]);
1053                                }
1054    
1055      std::sort(charge_v.begin(),charge_v.end());
1056      charge_median = charge_v[(int)(charge_v.size()/2+charge_v.size()%2)-1];
1057    
1058    //cout<<charge_mean<<" "<<charge_median<<endl;
1059    
1060      charge_mean = charge_median;
1061    
1062    }  // icount>0
1063    
1064  //--- Calculate charge for the second time, use residuals of the single  //--- Calculate charge for the second time, use residuals of the single
1065  //--- measurements to get a chi2 value  //--- measurements to get a chi2 value
# Line 873  if (icount>0) charge_mean = charge_mean/ Line 1106  if (icount>0) charge_mean = charge_mean/
1106    
1107  //  charge_tof = charge_chi;  //  charge_tof = charge_chi;
1108    
1109   } // 0.05 < fabs( beta) < 1.5  // changed 30-01-2009 WM
1110    
1111      for (Int_t jj=0; jj<48;jj++) charge_PMT_std[jj] = PMTcharge_arr[jj];
1112    for (Int_t jj=0; jj<6;jj++) charge_layer_std[jj] = Layercharge[jj];    for (Int_t jj=0; jj<6;jj++) charge_layer_std[jj] = Layercharge[jj];
1113    for (Int_t jj=0; jj<6;jj++) layerinfo_std[jj] = Layerinfo[jj];    for (Int_t jj=0; jj<6;jj++) layerinfo_std[jj] = Layerinfo[jj];
1114    charge_std = charge_chi;    charge_std = charge_chi;
1115    ncount_std = ncount;    ncount_std = ncount;
1116    
1117     } // 0.05 < fabs( beta) < 2.0
1118    
1119    
1120  } // standalone track found  } // standalone track found
1121    
1122  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.23