/[PAMELA software]/calo/flight/CaloNuclei/src/CaloNuclei.cpp
ViewVC logotype

Diff of /calo/flight/CaloNuclei/src/CaloNuclei.cpp

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

revision 1.2 by mocchiut, Wed Apr 4 11:04:58 2007 UTC revision 1.4 by mocchiut, Thu Apr 5 13:38:32 2007 UTC
# Line 22  CaloNuclei::CaloNuclei(PamLevel2 *l2p){ Line 22  CaloNuclei::CaloNuclei(PamLevel2 *l2p){
22    N = 5;    N = 5;
23    R = 3;    R = 3;
24    //    //
25      debug = false;
26      //
27  };  };
28    
29  void CaloNuclei::Clear(){  void CaloNuclei::Clear(){
30    //    //
31      tr = 0;
32    interplane = 0;    interplane = 0;
33    preq = 0.;    preq = 0.;
34    postq = 0.;    postq = 0.;
# Line 43  void CaloNuclei::Print(){ Line 46  void CaloNuclei::Print(){
46    //    //
47    Process();    Process();
48    //    //
49    printf("===================================================================\n");    printf("========================================================================\n");
50    printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime);    printf(" OBT: %u PKT: %u ATIME: %u Track %i \n",OBT,PKT,atime,tr);
51    printf(" interplane [number of available dE/dx before interaction]: %i\n",interplane);    printf(" interplane [number of available dE/dx before interaction]: %i\n",interplane);
52    printf(" ethr [threshold used to determine interplane]:............ %f \n",ethr);    printf(" ethr [threshold used to determine interplane]:............ %f \n",ethr);
53    printf(" dedx1 [dE/dx from the first calorimeter plane]:........... %f \n",dedx1);    printf(" dedx1 [dE/dx from the first calorimeter plane]:........... %f \n",dedx1);
# Line 57  void CaloNuclei::Print(){ Line 60  void CaloNuclei::Print(){
60    printf(" N [no of used plane]:..................................... %i \n",N);    printf(" N [no of used plane]:..................................... %i \n",N);
61    printf(" R [no strip used per plane ]:............................. %i \n",R);    printf(" R [no strip used per plane ]:............................. %i \n",R);
62    printf(" qpremeanN [truncated mean using N planes and R strips]:... %f \n",qpremeanN);    printf(" qpremeanN [truncated mean using N planes and R strips]:... %f \n",qpremeanN);
63    printf("===================================================================\n");    printf("========================================================================\n");
64    //    //
65  };  };
66    
# Line 68  void CaloNuclei::Delete(){ Line 71  void CaloNuclei::Delete(){
71    
72    
73  void CaloNuclei::Process(){  void CaloNuclei::Process(){
74    //    Process(0);
75    };
76    
77    void CaloNuclei::Process(Int_t ntr){
78      //  
79    if ( !L2 ){    if ( !L2 ){
80      printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n");      printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n");
81      printf(" ERROR: CaloNuclei variables not filled \n");      printf(" ERROR: CaloNuclei variables not filled \n");
# Line 90  void CaloNuclei::Process(){ Line 97  void CaloNuclei::Process(){
97    //    //
98    if ( !newentry ) return;    if ( !newentry ) return;
99    //    //
100    //  printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime);    tr = ntr;
101      //
102      if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime);
103    //    //
104    Clear();    Clear();
105    //    //
106    PamTrack *track = 0;    PamTrack *track = 0;
107    track = L2->GetTrack(0);    track = L2->GetTrack(ntr);
108    //    //
109    Int_t view = 0;    Int_t view = 0;
110    Int_t plane = 0;    Int_t plane = 0;
# Line 137  void CaloNuclei::Process(){ Line 146  void CaloNuclei::Process(){
146    //    //
147   retry:   retry:
148    //    //
149    //  printf("retry\n");    if ( debug ) printf("retry\n");
150    //    //
151    interplane = 0;    interplane = 0;
152    //    //
# Line 161  void CaloNuclei::Process(){ Line 170  void CaloNuclei::Process(){
170      if ( strip != -1 && mip > ethr && !wmulthit[view] && !wgap[view] &&      if ( strip != -1 && mip > ethr && !wmulthit[view] && !wgap[view] &&
171           ( strip == (track->GetCaloTrack()->tibar[plane][view]-1) || strip == (track->GetCaloTrack()->tibar[plane][view]-2) || strip == (track->GetCaloTrack()->tibar[plane][view]) )           ( strip == (track->GetCaloTrack()->tibar[plane][view]-1) || strip == (track->GetCaloTrack()->tibar[plane][view]-2) || strip == (track->GetCaloTrack()->tibar[plane][view]) )
172           && true ){                 && true ){      
173        //      printf(" inside loop: ii %i mip %f view %i plane %i strip %i tibar %i nhit %i splane %i sview %i \n",ii,mip,view,plane,strip,track->GetCaloTrack()->tibar[plane][view]-1,nhit[view],splane[view],sview[view]);        if ( debug ) printf(" inside loop: ii %i mip %f view %i plane %i strip %i tibar %i nhit %i splane %i sview %i \n",ii,mip,view,plane,strip,track->GetCaloTrack()->tibar[plane][view]-1,nhit[view],splane[view],sview[view]);
174        interpl[view] = plane;        interpl[view] = plane;
175        interv[view] = view;        interv[view] = view;
176        if ( splane[view] != plane || sview[view] != view ){        if ( splane[view] != plane || sview[view] != view ){
177          if ( nhit[view] > 1 ){          if ( nhit[view] > 1 ){
178            wmulthit[view] = true;            wmulthit[view] = true;
179              //      if ( splane[view] == -1 ) splane[view] = 0; //
180              //      if ( sview[view] == -1 ) sview[view] = view; //
181            interpl[view] = splane[view];            interpl[view] = splane[view];
182            interv[view] = sview[view];            interv[view] = sview[view];    
           //      ii = L2->GetCaloLevel1()->istrip;  
183          };          };
184          if ( plane > splane[view]+gapth ){          if ( plane > splane[view]+gapth ){
185            wgap[view] = true;            wgap[view] = true;
186              //      if ( splane[view] == -1 ) splane[view] = 0;//
187              //      if ( sview[view] == -1 ) sview[view] = view; //
188            interpl[view] = splane[view];            interpl[view] = splane[view];
189            interv[view] = sview[view];            interv[view] = sview[view];
           //      ii = L2->GetCaloLevel1()->istrip;  
190          };          };
191          splane[view] = plane;          splane[view] = plane;
192          sview[view] = view;          sview[view] = view;
# Line 189  void CaloNuclei::Process(){ Line 200  void CaloNuclei::Process(){
200      //          //    
201    };    };
202    //    //
203    //  printf("conversion interpl %i interv %i multhit %i interplane %i \n",interpl[0],interv[0],multhit,interplane);    if (debug ) printf("conversion interpl %i interv %i multhit %i interplane %i \n",interpl[0],interv[0],multhit,interplane);
204    Int_t winterplane[2] = {-1,-1};    Int_t winterplane[2] = {-1,-1};
205    //    //
206    for ( Int_t view = 0; view < 2; view++){    for ( Int_t view = 0; view < 2; view++){
# Line 228  void CaloNuclei::Process(){ Line 239  void CaloNuclei::Process(){
239      };      };
240    };    };
241    //      //  
242    //  printf("2conversion interpl %i interv %i multhit %i interplane %i \n",interpl[1],interv[1],multhit,interplane);    if ( debug ) printf("2conversion interpl %i interv %i multhit %i interplane %i \n",interpl[1],interv[1],multhit,interplane);
243    //  printf("3conversion winterpl0 %i winterpl1 %i \n",winterplane[0],winterplane[1]);    if ( debug ) printf("3conversion winterpl0 %i winterpl1 %i \n",winterplane[0],winterplane[1]);
244    //    //
245    Int_t ipl = 0;    Int_t ipl = 0;
246    if ( interplane > 0 ){    if ( interplane > 0 ){
# Line 267  void CaloNuclei::Process(){ Line 278  void CaloNuclei::Process(){
278                qsplane = plane;                qsplane = plane;
279                qsview = view;                qsview = view;
280                ind++;                ind++;
281                if ( ind > 199 ) printf(" AAAGH!! \n");                if ( debug && ind > 199 ) printf(" AAAGH!! \n");
282                qme[ind] = 0.;                qme[ind] = 0.;
283              };              };
284              qme[ind] += mip;              qme[ind] += mip;
# Line 279  void CaloNuclei::Process(){ Line 290  void CaloNuclei::Process(){
290                  qsplane2 = plane;                  qsplane2 = plane;
291                  qsview2 = view;                  qsview2 = view;
292                  ind2++;                  ind2++;
293                  if ( ind2 > 2112 ) printf(" AAAGH!! \n");                  if ( debug && ind2 > 2112 ) printf(" AAAGH!! \n");
294                  qme2[ind2] = 0.;                  qme2[ind2] = 0.;
295                };                };
296                qme2[ind2] += mip;                qme2[ind2] += mip;
# Line 295  void CaloNuclei::Process(){ Line 306  void CaloNuclei::Process(){
306      //      //
307      // here we must calculate qpremean, order vector qme, select 3 lowest measurements and caculate the mean...      // here we must calculate qpremean, order vector qme, select 3 lowest measurements and caculate the mean...
308      //          //    
309  //     for (Int_t l=0; l < interplane; l++){      if ( debug ){
310  //       printf(" qme[%i] = %f \n",l,qme[l]);          for (Int_t l=0; l < interplane; l++){
311  //     //       //      if ( qme[ind] < 6.25 ) qme[ind] = 10000.;                printf(" qme[%i] = %f \n",l,qme[l]);  
312  //     };        };
313        };
314        //
315      Long64_t work[200];      Long64_t work[200];
316      ind = 0;      ind = 0;
317      Int_t l = 0;      Int_t l = 0;
# Line 314  void CaloNuclei::Process(){ Line 327  void CaloNuclei::Process(){
327        if ( qm >= qmt ){        if ( qm >= qmt ){
328          if ( l < 3 ) qpremean += qm;          if ( l < 3 ) qpremean += qm;
329          l++;          l++;
330          //      printf(" value no %i qm %f qmt %f \n",l,qm,qmt);          if ( debug ) printf(" value no %i qm %f qmt %f \n",l,qm,qmt);
331        };        };
332        ind++;        ind++;
333      };      };
334      //      //
335        qpremean /= l;
336        //
337      ind = 0;      ind = 0;
338      l = 0;      l = 0;
339      while ( l < uplim && ind < interplane ){      while ( l < uplim && ind < interplane ){
# Line 326  void CaloNuclei::Process(){ Line 341  void CaloNuclei::Process(){
341        if ( qm2 >= qmt ){                if ( qm2 >= qmt ){        
342          if ( l < N ) qpremeanN += qm2;          if ( l < N ) qpremeanN += qm2;
343          l++;          l++;
344          //      printf(" value no %i qm %f qmt %f \n",l,qm,qmt);          if ( debug ) printf(" qm2 value no %i qm %f qmt %f \n",l,qm2,qmt);
345        };        };
346        ind++;        ind++;
347      };      };
348      //      //
349      qpremean /= l;      qpremeanN /= l;
     qpremeanN /= N;  
     //  
     //  printf(" charge is %f \n",sqrt(qpremean));  
350      //      //
351      //    printf("preq postq\n");          if ( debug ) printf(" charge is %f \n",sqrt(qpremean));
352      //      //
353      if ( mesethr != ethr && interplane >= 3 && !aldone ){      if ( mesethr != ethr && interplane >= 3 && !aldone ){
354        Float_t mesethr2 = (sqrt(qpremean) - 0.50)*(sqrt(qpremean) - 0.50);        Float_t mesethr2 = (sqrt(qpremean) - 0.50)*(sqrt(qpremean) - 0.50);
# Line 350  void CaloNuclei::Process(){ Line 362  void CaloNuclei::Process(){
362      };      };
363    };    };
364    //    //
365    //  printf(" esci \n");    if ( debug ) printf(" esci \n");
366    //    //
367  };  };

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

  ViewVC Help
Powered by ViewVC 1.1.23