/[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.1 by mocchiut, Tue Apr 3 15:55:16 2007 UTC revision 1.2 by mocchiut, Wed Apr 4 11:04:58 2007 UTC
# Line 20  CaloNuclei::CaloNuclei(PamLevel2 *l2p){ Line 20  CaloNuclei::CaloNuclei(PamLevel2 *l2p){
20    PKT = 0;    PKT = 0;
21    atime = 0;    atime = 0;
22    N = 5;    N = 5;
23      R = 3;
24    //    //
25  };  };
26    
# Line 40  void CaloNuclei::Clear(){ Line 41  void CaloNuclei::Clear(){
41    
42  void CaloNuclei::Print(){  void CaloNuclei::Print(){
43    //    //
44    printf("==============================\n");    Process();
45      //
46      printf("===================================================================\n");
47    printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime);    printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime);
48    printf(" interplane: %i\n",interplane);    printf(" interplane [number of available dE/dx before interaction]: %i\n",interplane);
49    printf(" ethr: %f \n",ethr);    printf(" ethr [threshold used to determine interplane]:............ %f \n",ethr);
50    printf(" dedx1: %f \n",dedx1);    printf(" dedx1 [dE/dx from the first calorimeter plane]:........... %f \n",dedx1);
51    printf(" dedx3: %f \n",dedx3);    printf(" dedx3 [dE/dx (average) if the first 3 Si planes]:......... %f \n",dedx3);
52    printf(" multhit: %i \n",multhit);    printf(" multhit [true if interplane determined by multiple hits]:. %i \n",multhit);
53    printf(" gap: %i \n",gap);    printf(" gap [true if interplane determined by a gap]:............. %i \n",gap);
54    printf(" preq: %f \n",preq);    printf(" preq [total energy in MIP before the interaction plane]:.. %f \n",preq);
55    printf(" postq: %f \n",postq);    printf(" postq [total energy in MIP after the interaction plane]:.. %f \n",postq);
56    printf(" qpremean: %f \n",qpremean);    printf(" qpremean [truncated mean using 3 planes and 3 strips]:.... %f \n",qpremean);
57    printf(" N: %i \n",N);    printf(" N [no of used plane]:..................................... %i \n",N);
58    printf(" qpremeanN: %f \n",qpremeanN);    printf(" R [no strip used per plane ]:............................. %i \n",R);
59    printf("==============================\n");    printf(" qpremeanN [truncated mean using N planes and R strips]:... %f \n",qpremeanN);
60      printf("===================================================================\n");
61    //    //
62  };  };
63    
# Line 236  void CaloNuclei::Process(){ Line 240  void CaloNuclei::Process(){
240      Int_t ind = -1;      Int_t ind = -1;
241      Int_t qsplane = -1;      Int_t qsplane = -1;
242      Int_t qsview = -1;      Int_t qsview = -1;
243        Int_t ind2 = -1;
244        Int_t qsplane2 = -1;
245        Int_t qsview2 = -1;
246      Float_t qme[200];      Float_t qme[200];
247      memset(qme,0,200*sizeof(Float_t));      memset(qme,0,200*sizeof(Float_t));
248        Float_t qme2[2112];
249        memset(qme2,0,2112*sizeof(Float_t));
250      //      //
251      while ( ii<L2->GetCaloLevel1()->istrip ){      while ( ii<L2->GetCaloLevel1()->istrip ){
252        //        //
# Line 263  void CaloNuclei::Process(){ Line 272  void CaloNuclei::Process(){
272              };              };
273              qme[ind] += mip;              qme[ind] += mip;
274            };            };
275              for ( Int_t ns = 0; ns < R ; ns++){
276                Int_t ms =  track->GetCaloTrack()->tibar[plane][view] - 1 - ns + (R - 1)/2;
277                if ( strip == ms ){
278                  if ( qsplane2 != plane || qsview2 != view ){
279                    qsplane2 = plane;
280                    qsview2 = view;
281                    ind2++;
282                    if ( ind2 > 2112 ) printf(" AAAGH!! \n");
283                    qme2[ind2] = 0.;
284                  };
285                  qme2[ind2] += mip;
286                };
287              };    
288          };                };      
289          //          //
290        };        };
# Line 273  void CaloNuclei::Process(){ Line 295  void CaloNuclei::Process(){
295      //      //
296      // 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...
297      //          //    
298      //    for (Int_t l=0; l < interplane; l++){  //     for (Int_t l=0; l < interplane; l++){
299      //       printf(" qme[%i] = %f \n",l,qme[l]);    //       printf(" qme[%i] = %f \n",l,qme[l]);  
300      //       //      if ( qme[ind] < 6.25 ) qme[ind] = 10000.;        //     //       //      if ( qme[ind] < 6.25 ) qme[ind] = 10000.;      
301      //     };  //     };
302      Long64_t work[200];      Long64_t work[200];
303      ind = 0;      ind = 0;
304      Int_t l = 0;      Int_t l = 0;
305      Float_t qm = 0.;      Float_t qm = 0.;
306        Float_t qm2 = 0.;
307        //
308        Float_t qmt = ethr*0.8; // *0.9
309        //
310      Int_t uplim = TMath::Max(3,N);      Int_t uplim = TMath::Max(3,N);
311        //
312      while ( l < uplim && ind < interplane ){      while ( l < uplim && ind < interplane ){
313        qm = TMath::KOrdStat(interplane,qme,ind,work);        qm = TMath::KOrdStat(interplane,qme,ind,work);
314        if ( qm >= mesethr*0.9 ){        if ( qm >= qmt ){
315          if ( l < 3 ) qpremean += qm;          if ( l < 3 ) qpremean += qm;
         if ( l < N ) qpremeanN += qm;  
316          l++;          l++;
317          //      printf(" value no %i qm %f \n",l,qm);          //      printf(" value no %i qm %f qmt %f \n",l,qm,qmt);
318          };
319          ind++;
320        };
321        //
322        ind = 0;
323        l = 0;
324        while ( l < uplim && ind < interplane ){
325          qm2 = TMath::KOrdStat(interplane,qme2,ind,work);
326          if ( qm2 >= qmt ){        
327            if ( l < N ) qpremeanN += qm2;
328            l++;
329            //      printf(" value no %i qm %f qmt %f \n",l,qm,qmt);
330        };        };
331        ind++;        ind++;
332      };      };

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

  ViewVC Help
Powered by ViewVC 1.1.23