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

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

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

revision 1.4 by mocchiut, Wed Jul 29 12:58:27 2009 UTC revision 1.11 by mocchiut, Mon Aug 17 15:00:53 2009 UTC
# Line 39  void CaloEnergy::UseCaloPreSampler(){ Line 39  void CaloEnergy::UseCaloPreSampler(){
39    //    //
40    // use the presampler setting forcefitmode to 1000 means to force the DV routine to find the track inside the calorimeter using the "shower" approach developed for electrons    // use the presampler setting forcefitmode to 1000 means to force the DV routine to find the track inside the calorimeter using the "shower" approach developed for electrons
41    //    //
42    cp = new CaloPreSampler(L2);    if ( !cp ) cp = new CaloPreSampler(L2);
43    cp->SplitInto(0,22);    cp->SplitInto(0,22);
44    cp->SetForceFitMode(1000);    cp->SetForceFitMode(1000);
45  //   cp->UseTracker(false);  //   cp->UseTracker(false);
46  //   cp->ForceCaloFit();  //   cp->ForceCaloFit();
47  //   cp->SetDebug(true);  //   cp->SetDebug(true);
48  //   cp->Process();  //   cp->Process();
49      if ( clong ) clong->SetCaloLevel2Pointer(cp->GetLevel2Pointer());
50    }
51    
52    
53    void CaloEnergy::UseLongFit(){
54      fPl = 0;
55      fLong = true;
56      if ( !clong ){
57        clong = new CaloLong(L2);
58        if ( cp ) clong->SetCaloLevel2Pointer(cp->GetLevel2Pointer());
59        clong->SplitInto(0,22);
60      };
61      //
62  }  }
63    
64  void CaloEnergy::Set(){  void CaloEnergy::Set(){
# Line 70  void CaloEnergy::Set(){ Line 83  void CaloEnergy::Set(){
83    fPl = 1;    fPl = 1;
84    fRad = -1;    fRad = -1;
85    cp = NULL;    cp = NULL;
86      clong = NULL;
87      x0max = -1.;
88    //    //
89    this->DefineGeometry();    this->DefineGeometry();
90    fXosel =true;    fXosel =true;
# Line 139  Int_t CaloEnergy::GetMaxplane(TString se Line 154  Int_t CaloEnergy::GetMaxplane(TString se
154    return(-1);    return(-1);
155  }  }
156    
157    Float_t CaloEnergy::GetEnergyAtMaxplane(TString section){
158      section.ToUpper();
159      if ( section.Contains("XO") ) return xomax_en;
160      if ( section.Contains("XE") ) return xemax_en;
161      if ( section.Contains("YO") ) return yomax_en;
162      if ( section.Contains("YE") ) return yemax_en;
163      return(-1);
164    }
165    
166  Float_t CaloEnergy::GetMaxEnergy(TString section){  Float_t CaloEnergy::GetMaxEnergy(TString section){
167    section.ToUpper();    section.ToUpper();
168    if ( section.Contains("XO") ) return fXOen_maxplane;    if ( fLong ){
169    if ( section.Contains("XE") ) return fXEen_maxplane;      this->Process(section);    
170    if ( section.Contains("YO") ) return fYOen_maxplane;      return fXOen_maxplane;
171    if ( section.Contains("YE") ) return fYEen_maxplane;    } else {
172        if ( section.Contains("XO") ) return fXOen_maxplane;
173        if ( section.Contains("XE") ) return fXEen_maxplane;
174        if ( section.Contains("YO") ) return fYOen_maxplane;
175        if ( section.Contains("YE") ) return fYEen_maxplane;
176      };
177    return(-1);    return(-1);
178  }  }
179    
180    Float_t CaloEnergy::GetMaxEnergy(){  
181      if ( fLong ){
182        if ( debug ) printf(" oh! call process! with asntr %s and sntr %s \n",asntr.Data(),sntr.Data());
183        this->Process(asntr);
184      };
185      return((fXEen_maxplane+fYOen_maxplane+fYEen_maxplane+fXOen_maxplane));
186    }
187    
188  void CaloEnergy::DefineGeometry(){  void CaloEnergy::DefineGeometry(){
189    //    //
190    // Use CaloStrip to determine once the position of border strips for each section    // Use CaloStrip to determine once the position of border strips for each section
191    //    //
192    //    //
193    fM = 2. + 0.096; // real position from cbar    //  fM = 2. + 0.096; // real position from cbar BUG the 0.096 is already taken into account in the border calculation made by Giovanna
194    fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc.    fM = 2. ; // real position from cbar
195      //  fM1 = 2. - 0.122 - 0.096; // due to calculation of xe1 etc. BUG! this way we count from the silicon border not from the silicon sensitive area
196      fM1 = 2. - 0.122 - 0.096 + 0.096; // due to calculation of xe1 etc.
197    if ( fM1 < 0. ) fM1 = 0.;    if ( fM1 < 0. ) fM1 = 0.;
198    //    //
199    CaloStrip *cs = new CaloStrip(fSimu);    CaloStrip *cs = new CaloStrip(fSimu);
# Line 179  void CaloEnergy::DefineGeometry(){ Line 218  void CaloEnergy::DefineGeometry(){
218    cs->Set(1,0,95);    cs->Set(1,0,95);
219    xe6= cs->GetY();    xe6= cs->GetY();
220    
221      //  printf(" xe1 %f xe2 %f xe3 %f xe4 %f xe5 %f xe6 %f \n",xe1,xe2,xe3,xe4,xe5,xe6);
222    
223    // view x plane 0 strip 0    // view x plane 0 strip 0
224    cs->Set(0,0,0);    cs->Set(0,0,0);
225    yo1= cs->GetX();    yo1= cs->GetX();
# Line 199  void CaloEnergy::DefineGeometry(){ Line 240  void CaloEnergy::DefineGeometry(){
240    cs->Set(0,0,95);    cs->Set(0,0,95);
241    yo6= cs->GetX();    yo6= cs->GetX();
242    
     
243    // view y plane 1 strip 0    // view y plane 1 strip 0
244    cs->Set(1,1,0);    cs->Set(1,1,0);
245    xo1= cs->GetY();    xo1= cs->GetY();
# Line 240  void CaloEnergy::DefineGeometry(){ Line 280  void CaloEnergy::DefineGeometry(){
280    cs->Set(0,1,95);    cs->Set(0,1,95);
281    ye6= cs->GetX();    ye6= cs->GetX();
282    
283      //printf(" ye1 %f ye2 %f ye3 %f ye4 %f ye5 %f ye6 %f \n",ye1,ye2,ye3,ye4,ye5,ye6);
284      
285    //    //
286    for (Int_t p = 0; p<22; p ++){    for (Int_t p = 0; p<22; p ++){
287      for (Int_t v = 0; v<2; v++ ){        for (Int_t v = 0; v<2; v++ ){  
# Line 272  void CaloEnergy::Clear(){ Line 314  void CaloEnergy::Clear(){
314    fMax_planexo = 0;    fMax_planexo = 0;
315    fMax_planexe = 0;    fMax_planexe = 0;
316    fMax_planeyo = 0;    fMax_planeyo = 0;
317    fMax_planeye = 0;    fMax_planeye = 0;
318      xomax_en= 0.;
319      xemax_en= 0.;
320      yomax_en= 0.;
321      yemax_en= 0.;
322      //
323    memset(enstrip,0,2*22*96*(sizeof(Float_t)));      memset(enstrip,0,2*22*96*(sizeof(Float_t)));  
324    en = 0.;    en = 0.;
325    view = 0;    view = 0;
# Line 336  void CaloEnergy::Print(){ Line 383  void CaloEnergy::Print(){
383    printf(" energyxo:.............. %f \n",energyxo);    printf(" energyxo:.............. %f \n",energyxo);
384    printf(" energyye:.............. %f \n",energyye);    printf(" energyye:.............. %f \n",energyye);
385    printf(" energyyo:.............. %f \n",energyyo);    printf(" energyyo:.............. %f \n",energyyo);
386      printf(" fXEen_maxplane:........ %f \n",fXEen_maxplane);
387      printf(" fXOen_maxplane:........ %f \n",fXOen_maxplane);
388      printf(" fYEen_maxplane:........ %f \n",fYEen_maxplane);
389      printf(" fYOen_maxplane:........ %f \n",fYOen_maxplane);
390      printf(" x0max   :.............. %f \n",x0max);
391    printf(" debug   :.............. %i \n",debug);    printf(" debug   :.............. %i \n",debug);
392    
393    printf("========================================================================\n");    printf("========================================================================\n");
# Line 411  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 463  Bool_t CaloEnergy::IsInsideAcceptance(TS
463      enstrip[view][plane][strip]=en;      enstrip[view][plane][strip]=en;
464    };    };
465    //    //
466      if ( debug && ((fM1+0.122-0.244*(Float_t)fRad) < 0.) ) printf("Error: (fM1+0.122-0.244*(Float_t)fRad) < 0. fM1 %f fRad %i %f \n",fM1,fRad,(fM1+0.122-0.244*(Float_t)fRad));
467      //
468    // sum energy plane by plane for each sections    // sum energy plane by plane for each sections
469    //    //
470    for (Int_t i=0;i<11;i++){    for (Int_t i=0;i<11;i++){
471      for(strip=0; strip<96; strip++) {      for(strip=0; strip<96; strip++) {
472        if ( fRad < 0 ){        if ( fRad < 0 ){
473          //          //
474          // run over all the strips of the plane          // run over all the strips of the plane
475          //          //
476          en_xep[i] += enstrip[1][2*i][strip];          en_xep[i] += enstrip[1][2*i][strip];
477          en_yop[i] += enstrip[0][2*i][strip];          en_yop[i] += enstrip[0][2*i][strip];
478          en_xop[i] += enstrip[1][2*i+1][strip];          en_xop[i] += enstrip[1][(2*i)+1][strip];
479          en_yep[i] += enstrip[0][2*i+1][strip];          en_yep[i] += enstrip[0][(2*i)+1][strip];
480        } else {        } else {
481          //          //
482          // use only the strips inside a cylinder of given radius fRad          // use only the strips inside a cylinder of given radius fRad
483          //          //
484          if ( strip >= cl2->cibar[2*i][1]-1-fRad &&  strip <= cl2->cibar[2*i][1]-1+fRad ) en_xep[i] += enstrip[1][2*i][strip];          if ( cl2->cibar[2*i][1] >= 1 && cl2->cibar[2*i][1] <= 96 && (strip >= (cl2->cibar[2*i][1]-1-fRad)) &&  (strip <= (cl2->cibar[2*i][1]-1+fRad)) ) en_xep[i] += enstrip[1][2*i][strip];
485          if ( strip >= cl2->cibar[2*i][0]-1-fRad &&  strip <= cl2->cibar[2*i][0]-1+fRad ) en_yop[i] += enstrip[0][2*i][strip];          if ( cl2->cibar[2*i][0] >= 1 && cl2->cibar[2*i][0] <= 96 && (strip >= (cl2->cibar[2*i][0]-1-fRad)) &&  (strip <= (cl2->cibar[2*i][0]-1+fRad)) ) en_yop[i] += enstrip[0][2*i][strip];
486          if ( strip >= cl2->cibar[2*i+1][1]-1-fRad &&  strip <= cl2->cibar[2*i+1][1]-1+fRad ) en_xop[i] += enstrip[1][2*i+1][strip];          if ( cl2->cibar[(2*i)+1][1] >= 1 && cl2->cibar[(2*i)+1][1] <= 96 && (strip >= (cl2->cibar[(2*i)+1][1]-1-fRad)) &&  (strip <= (cl2->cibar[(2*i)+1][1]-1+fRad)) ) en_xop[i] += enstrip[1][(2*i)+1][strip];
487          if ( strip >= cl2->cibar[2*i+1][0]-1-fRad &&  strip <= cl2->cibar[2*i+1][0]-1+fRad ) en_yep[i] += enstrip[0][2*i+1][strip];          if ( cl2->cibar[(2*i)+1][0] >= 1 && cl2->cibar[(2*i)+1][0] <= 96 && (strip >= (cl2->cibar[(2*i)+1][0]-1-fRad)) &&  (strip <= (cl2->cibar[(2*i)+1][0]-1+fRad)) ) en_yep[i] += enstrip[0][(2*i)+1][strip];
488        };        };
489      };      };
490      energyxe += en_xep[i];      energyxe += en_xep[i];
# Line 441  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 495  Bool_t CaloEnergy::IsInsideAcceptance(TS
495    //    //
496    // Find the plane of maximum for each section    // Find the plane of maximum for each section
497    //    //
   Float_t xomax_en= 0.;  
   Float_t xemax_en= 0.;  
   Float_t yomax_en= 0.;  
   Float_t yemax_en= 0.;  
   //  
498    //    //
499    Int_t xen = 0;    Int_t xen = 0;
500    Int_t yon = 0;    Int_t yon = 0;
# Line 494  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 543  Bool_t CaloEnergy::IsInsideAcceptance(TS
543      };      };
544    };    };
545    //    //
546      // the maximum is given externally as X0, convert it to plane and section
547      //
548      if ( x0max > 0. ){
549        if ( debug ) printf(" CALCULATE MAX PLANE GIVEN X0 ASSUMING PERPENDICULAR TRACK \n");
550        Int_t wpl = (Int_t)roundf(x0max/0.76);
551        Bool_t isY = false;
552        if ( ((x0max/0.76)-(Float_t)wpl) > 0. ) isY = true;
553        xomax_en = 0.;
554        yemax_en = 0.;
555        xemax_en = 0.;
556        yomax_en = 0.;
557        //
558        if ( !(wpl%2) ){
559          // 0, 2, 4, ...
560          if ( isY ){
561            if ( section.Contains("YO") ) yomax_en = 1000.;
562            if ( section.Contains("XE") ) xemax_en = 500.;
563            fMax_planeyo=wpl/2;
564            fMax_planexe=wpl/2;
565            if ( section.Contains("XO") ) xomax_en = 10.;
566            if ( section.Contains("YE") ) yemax_en = 5.;
567          } else {
568            if ( section.Contains("YO") ) yomax_en = 500.;
569            if ( section.Contains("XE") ) xemax_en = 1000.;
570            fMax_planeyo=wpl/2;
571            fMax_planexe=wpl/2;
572            if ( section.Contains("XO") ) xomax_en = 5.;
573            if ( section.Contains("YE") ) yemax_en = 10.;
574          };
575        } else {
576          // 1, 3, 5, ...
577          if ( isY ){
578            if ( section.Contains("YE") ) yemax_en = 1000.;
579            if ( section.Contains("XO") ) xomax_en = 500.;
580            fMax_planeye=(wpl-1)/2;
581            fMax_planexo=(wpl-1)/2;
582            if ( section.Contains("XE") ) xemax_en = 10.;
583            if ( section.Contains("YO") ) yomax_en = 5.;
584          } else {
585            if ( section.Contains("YE") ) yemax_en = 500.;
586            if ( section.Contains("XO") ) xomax_en = 1000.;
587            fMax_planeye=(wpl-1)/2;
588            fMax_planexo=(wpl-1)/2;
589            if ( section.Contains("XE") ) xemax_en = 5.;
590            if ( section.Contains("YO") ) yomax_en = 10.;
591          };
592        };
593        if ( debug ) printf(" x0max %f x0max/0.76 %f wpl %i isY %i yomax_en %f xemax_en %f yemax_en %f xomax_en %f fMaxplane %i %i %i %i\n",x0max,(x0max/0.76),wpl,isY,yomax_en,xemax_en,yemax_en,xomax_en,fMax_planeyo,fMax_planexe,fMax_planeye,fMax_planexo);
594      };
595      //
596    Int_t nPl = fPl;    Int_t nPl = fPl;
597    //    //
598    // Set the maximum in case of coherent mode was selected    // Set the maximum in case of coherent mode was selected
# Line 563  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 662  Bool_t CaloEnergy::IsInsideAcceptance(TS
662    //    //
663    // for each plane of the calorimeter find the position of the track in the direction along the strip (where we do not have a measurement from the selected plane) by looking at the plane above/below of the other view and extrapolating the trajectory to the given plane    // for each plane of the calorimeter find the position of the track in the direction along the strip (where we do not have a measurement from the selected plane) by looking at the plane above/below of the other view and extrapolating the trajectory to the given plane
664    //    //
   Float_t  track_coordx[22][2];  
   Float_t  track_coordy[22][2];  
665    //    //
666    Float_t tgx_cl2;    Float_t tgx_cl2;
667    Float_t tgy_cl2;      Float_t tgy_cl2;  
# Line 574  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 671  Bool_t CaloEnergy::IsInsideAcceptance(TS
671    for (Int_t p=0; p<22; p++){        for (Int_t p=0; p<22; p++){    
672      track_coordy[p][1] = cl2->cbar[p][1];      track_coordy[p][1] = cl2->cbar[p][1];
673      track_coordx[p][1] = cl2->cbar[p][0] - fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2;      track_coordx[p][1] = cl2->cbar[p][0] - fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2;
674        //    track_coordx[p][1] = cl2->cbar[p][0] + fabs(trk_z[p][1]-trk_z[p][0])*tgx_cl2;
675      track_coordx[p][0] = cl2->cbar[p][0];      track_coordx[p][0] = cl2->cbar[p][0];
676      track_coordy[p][0] = cl2->cbar[p][1] - fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2;      track_coordy[p][0] = cl2->cbar[p][1] - fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2;
677        //    track_coordy[p][0] = cl2->cbar[p][1] + fabs(trk_z[p][1]-trk_z[p][0])*tgy_cl2;
678      if ( debug ) printf(" p %i track_coordy[p][1] %f track_coordx[p][1] %f track_coordx[p][0] %f  track_coordy[p][0] %f \n",p,track_coordy[p][1],track_coordx[p][1],track_coordx[p][0],track_coordy[p][0]);      if ( debug ) printf(" p %i track_coordy[p][1] %f track_coordx[p][1] %f track_coordx[p][0] %f  track_coordy[p][0] %f \n",p,track_coordy[p][1],track_coordx[p][1],track_coordx[p][0],track_coordy[p][0]);
679    };    };
680    //    //
# Line 588  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 687  Bool_t CaloEnergy::IsInsideAcceptance(TS
687      for (Int_t i=0; i<11; i++) {      for (Int_t i=0; i<11; i++) {
688        if        if
689          (          (
690           (((track_coordx[2*i+1][1]>=(-12.054+fM))&&           (((track_coordx[(2*i)+1][1]>=(-12.054+fM))&&
691             (track_coordx[2*i+1][1]<=(-4.246-fM)))&&             (track_coordx[(2*i)+1][1]<=(-4.246-fM)))&&
692            (((cl2->cbar[2*i+1][1]>=xo1 + fM1)&&            (((cl2->cbar[(2*i)+1][1]>=xo1 + fM1)&&
693              (cl2->cbar[2*i+1][1]<=xo2 - fM1 ))||              (cl2->cbar[(2*i)+1][1]<=xo2 - fM1 ))||
694             ((cl2->cbar[2*i+1][1]>=xo3 + fM1)&&             ((cl2->cbar[(2*i)+1][1]>=xo3 + fM1)&&
695              (cl2->cbar[2*i+1][1]<=xo4 - fM1 ))||              (cl2->cbar[(2*i)+1][1]<=xo4 - fM1 ))||
696             ((cl2->cbar[2*i+1][1]>=xo5 + fM1)&&             ((cl2->cbar[(2*i)+1][1]>=xo5 + fM1)&&
697              (cl2->cbar[2*i+1][1]<=xo6 - fM1 ))))||              (cl2->cbar[(2*i)+1][1]<=xo6 - fM1 ))))||
698                    
699           (((track_coordx[2*i+1][1]>=(-4.004+fM))&&           (((track_coordx[(2*i)+1][1]>=(-4.004+fM))&&
700             (track_coordx[2*i+1][1]<=(3.804-fM)))&&             (track_coordx[(2*i)+1][1]<=(3.804-fM)))&&
701            (((cl2->cbar[2*i+1][1]>=xo1 + fM1)&&            (((cl2->cbar[(2*i)+1][1]>=xo1 + fM1)&&
702              (cl2->cbar[2*i+1][1]<=xo2 - fM1 ))||              (cl2->cbar[(2*i)+1][1]<=xo2 - fM1 ))||
703             ((cl2->cbar[2*i+1][1]>=xo3 + fM1)&&             ((cl2->cbar[(2*i)+1][1]>=xo3 + fM1)&&
704              (cl2->cbar[2*i+1][1]<=xo4 - fM1))||              (cl2->cbar[(2*i)+1][1]<=xo4 - fM1))||
705             ((cl2->cbar[2*i+1][1]>=xo5 + fM1)&&             ((cl2->cbar[(2*i)+1][1]>=xo5 + fM1)&&
706              (cl2->cbar[2*i+1][1]<=xo6 - fM1 ))))||              (cl2->cbar[(2*i)+1][1]<=xo6 - fM1 ))))||
707                    
708           (((track_coordx[2*i+1][1]>=(4.046+fM))&&           (((track_coordx[(2*i)+1][1]>=(4.046+fM))&&
709             (track_coordx[2*i+1][1]<=(11.854-fM)))&&             (track_coordx[(2*i)+1][1]<=(11.854-fM)))&&
710            (((cl2->cbar[2*i+1][1]>=xo1 + fM1)&&            (((cl2->cbar[(2*i)+1][1]>=xo1 + fM1)&&
711              (cl2->cbar[2*i+1][1]<=xo2 - fM1))||              (cl2->cbar[(2*i)+1][1]<=xo2 - fM1))||
712             ((cl2->cbar[2*i+1][1]>=xo3 + fM1)&&             ((cl2->cbar[(2*i)+1][1]>=xo3 + fM1)&&
713              (cl2->cbar[2*i+1][1]<=xo4 - fM1 ))||              (cl2->cbar[(2*i)+1][1]<=xo4 - fM1 ))||
714             ((cl2->cbar[2*i+1][1]>=xo5 + fM1)&&             ((cl2->cbar[(2*i)+1][1]>=xo5 + fM1)&&
715              (cl2->cbar[2*i+1][1]<=xo6 - fM1 ))))              (cl2->cbar[(2*i)+1][1]<=xo6 - fM1 ))))
716           ){           ){
717          fXosel = true;          fXosel = true;
718          fXoout = i;          fXoout = i;
# Line 634  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 733  Bool_t CaloEnergy::IsInsideAcceptance(TS
733      // event is contained (or partially contained) hence we can integrate energy up to the maximum and calculate the energy as measured by this section      // event is contained (or partially contained) hence we can integrate energy up to the maximum and calculate the energy as measured by this section
734      //      //
735      if ( fXosel ){      if ( fXosel ){
736        for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexo+nPl)) ;iplm++) fXOen_maxplane += en_xop[iplm];        for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexo+nPl)) ;iplm++){        
737            fXOen_maxplane += en_xop[iplm];
738            if ( debug ) printf(" XO iplm %i fXOen_maxplane %f  en_xop[iplm] %f\n",iplm,fXOen_maxplane,en_xop[iplm]);
739          };
740        fEnergyxo = fXOen_maxplane/fConv_rxo;        fEnergyxo = fXOen_maxplane/fConv_rxo;
741      };      };
742    };    };
# Line 683  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 785  Bool_t CaloEnergy::IsInsideAcceptance(TS
785        fXesel = true;        fXesel = true;
786      };      };
787      if ( fXesel ){      if ( fXesel ){
788        for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+nPl)) ;iplm++) fXEen_maxplane += en_xep[iplm];        for (Int_t iplm=0;iplm<=TMath::Min(10,(Int_t)(fMax_planexe+nPl)) ;iplm++){
789            fXEen_maxplane += en_xep[iplm];
790            if ( debug ) printf(" XE iplm %i fXOen_maxplane %f  en_xop[iplm] %f\n",iplm,fXEen_maxplane,en_xep[iplm]);
791          };
792        fEnergyxe = fXEen_maxplane/fConv_rxe;        fEnergyxe = fXEen_maxplane/fConv_rxe;
793      };      };
794    };      };  
# Line 692  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 797  Bool_t CaloEnergy::IsInsideAcceptance(TS
797      for (Int_t i=0; i<11; i++) {      for (Int_t i=0; i<11; i++) {
798        if        if
799          (          (
800           (((track_coordy[2*i+1][0]>=(-12.154+fM))&&           (((track_coordy[(2*i)+1][0]>=(-12.154+fM))&&
801             (track_coordy[2*i+1][0]<=(-4.346-fM)))&&             (track_coordy[(2*i)+1][0]<=(-4.346-fM)))&&
802            (((cl2->cbar[2*i+1][0]>=ye1 + fM1)&&            (((cl2->cbar[(2*i)+1][0]>=ye1 + fM1)&&
803              (cl2->cbar[2*i+1][0]<=ye2 - fM1 ))||              (cl2->cbar[(2*i)+1][0]<=ye2 - fM1 ))||
804             ((cl2->cbar[2*i+1][0]>=ye3 + fM1)&&             ((cl2->cbar[(2*i)+1][0]>=ye3 + fM1)&&
805              (cl2->cbar[2*i+1][0]<=ye4 - fM1 ))||              (cl2->cbar[(2*i)+1][0]<=ye4 - fM1 ))||
806             ((cl2->cbar[2*i+1][0]>=ye5 + fM1)&&             ((cl2->cbar[(2*i)+1][0]>=ye5 + fM1)&&
807              (cl2->cbar[2*i+1][0]<=ye6 - fM1 ))))||              (cl2->cbar[(2*i)+1][0]<=ye6 - fM1 ))))||
808                    
809           (((track_coordy[2*i+1][0]>=(-4.104+fM))&&           (((track_coordy[(2*i)+1][0]>=(-4.104+fM))&&
810             (track_coordy[2*i+1][0]<=(3.704-fM)))&&             (track_coordy[(2*i)+1][0]<=(3.704-fM)))&&
811            (((cl2->cbar[2*i+1][0]>=ye1 + fM1)&&            (((cl2->cbar[(2*i)+1][0]>=ye1 + fM1)&&
812              (cl2->cbar[2*i+1][0]<=ye2 - fM1 ))||              (cl2->cbar[(2*i)+1][0]<=ye2 - fM1 ))||
813             ((cl2->cbar[2*i+1][0]>=ye3 + fM1)&&             ((cl2->cbar[(2*i)+1][0]>=ye3 + fM1)&&
814              (cl2->cbar[2*i+1][0]<=ye4 - fM1))||              (cl2->cbar[(2*i)+1][0]<=ye4 - fM1))||
815             ((cl2->cbar[2*i+1][0]>=ye5 + fM1)&&             ((cl2->cbar[(2*i)+1][0]>=ye5 + fM1)&&
816              (cl2->cbar[2*i+1][0]<=ye6 - fM1 ))))||              (cl2->cbar[(2*i)+1][0]<=ye6 - fM1 ))))||
817                    
818           (((track_coordy[2*i+1][0]>=(3.946+fM))&&           (((track_coordy[(2*i)+1][0]>=(3.946+fM))&&
819             (track_coordy[2*i+1][0]<=(11.754-fM)))&&             (track_coordy[(2*i)+1][0]<=(11.754-fM)))&&
820            (((cl2->cbar[2*i+1][0]>=ye1 + fM1)&&            (((cl2->cbar[(2*i)+1][0]>=ye1 + fM1)&&
821              (cl2->cbar[2*i+1][0]<=ye2 - fM1))||              (cl2->cbar[(2*i)+1][0]<=ye2 - fM1))||
822             ((cl2->cbar[2*i+1][0]>=ye3 + fM1)&&             ((cl2->cbar[(2*i)+1][0]>=ye3 + fM1)&&
823              (cl2->cbar[2*i+1][0]<=ye4 - fM1 ))||              (cl2->cbar[(2*i)+1][0]<=ye4 - fM1 ))||
824             ((cl2->cbar[2*i+1][0]>=ye5 + fM1)&&             ((cl2->cbar[(2*i)+1][0]>=ye5 + fM1)&&
825              (cl2->cbar[2*i+1][0]<=ye6 - fM1 ))))              (cl2->cbar[(2*i)+1][0]<=ye6 - fM1 ))))
826           ){           ){
827          fYesel = true;          fYesel = true;
828          fYeout = i;          fYeout = i;
# Line 791  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 896  Bool_t CaloEnergy::IsInsideAcceptance(TS
896    // Count the number of sections in which the event is contained    // Count the number of sections in which the event is contained
897    //    //
898    fCount = (Float_t)((Int_t)fXesel+(Int_t)fXosel+(Int_t)fYesel+(Int_t)fYosel);    fCount = (Float_t)((Int_t)fXesel+(Int_t)fXosel+(Int_t)fYesel+(Int_t)fYosel);
   if ( debug ) printf(" IsInside XE %i XO %i YE %i YO %i => SEL %i \n",fXesel,fXosel,fYesel,fYosel,fSel);  
899    //    //
900    if ( indep ){    if ( indep ){
901      //      //
# Line 814  Bool_t CaloEnergy::IsInsideAcceptance(TS Line 918  Bool_t CaloEnergy::IsInsideAcceptance(TS
918    };    };
919    //    //
920    if ( debug ) printf("sel %i indep %i fMax_plane %f conv_r %f en_maxplane %f encalo %f  \n",fSel,indep,fMax_plane,fConv_rxo,fXOen_maxplane,fEnergy);    if ( debug ) printf("sel %i indep %i fMax_plane %f conv_r %f en_maxplane %f encalo %f  \n",fSel,indep,fMax_plane,fConv_rxo,fXOen_maxplane,fEnergy);
921      if ( debug ) printf(" IsInside XE %i XO %i YE %i YO %i => SEL %i \n",fXesel,fXosel,fYesel,fYosel,fSel);
922    //    //
923    // finish exit    // finish exit
924    //    //
# Line 865  void CaloEnergy::Process(TString section Line 970  void CaloEnergy::Process(TString section
970    if ( (fM1+0.122-0.244*(Float_t)fRad) < 0. ) printf("Error: (fM1+0.122-0.244*(Float_t)fRad) < 0. fM1 %f fRad %i %f \n",fM1,fRad,(fM1+0.122-0.244*(Float_t)fRad));    if ( (fM1+0.122-0.244*(Float_t)fRad) < 0. ) printf("Error: (fM1+0.122-0.244*(Float_t)fRad) < 0. fM1 %f fRad %i %f \n",fM1,fRad,(fM1+0.122-0.244*(Float_t)fRad));
971    //    //
972    if ( fLong ){    if ( fLong ){
973        if ( debug ) printf(" ==================================================================> LONGITUDINAL FIT! \n");
974        //
975        // use long fit to measure energy
976      //      //
977      // use long fit to measure energy NOT IMPLEMENTED YET      if ( this->IsInsideAcceptance(section) ){
978          //
979          if ( debug ) printf(" ==================================================================> LONG INSIDE! \n");
980          //
981          Float_t myene[2][22];
982          memset(myene,0,(sizeof(Float_t))*2*22);
983          for (Int_t j=0; j<11; j++){
984            if ( section.Contains("XE") ) myene[1][2*j] = en_xep[j];
985            if ( section.Contains("YO") ) myene[0][2*j] = en_yop[j];
986            if ( section.Contains("XO") ) myene[1][(2*j)+1] = en_xop[j];
987            if ( section.Contains("YE") ) myene[0][(2*j)+1] = en_yep[j];    
988          };
989          clong->UnMaskSections();
990          if ( !(section.Contains("YE")) ) clong->MaskSection("YE");
991          if ( !(section.Contains("YO")) ) clong->MaskSection("YO");
992          if ( !(section.Contains("XO")) ) clong->MaskSection("XO");
993          if ( !(section.Contains("XE")) ) clong->MaskSection("XE");
994          clong->ForceNextFit();
995          clong->SetEnergies(myene);
996          if ( debug ){
997            clong->Fit(true);
998          } else {
999            clong->Fit();
1000          };      
1001          if ( clong->GetLowerLimit() != 0. || clong->GetUpperLimit() != 0. ){
1002            fXOen_maxplane = clong->Get_defE0();
1003          } else {
1004            fXOen_maxplane = clong->Get_E0();
1005          };
1006          fMax_plane = clong->Get_tmax();
1007          fYOen_maxplane  = 0.;
1008          fYEen_maxplane = 0.;
1009          fXEen_maxplane = 0.;
1010          fEnergy=fXOen_maxplane/fConv_rxo;
1011          if ( fEnergy != fEnergy || clong->Get_fitresult() != 0 ) fEnergy = -1.;
1012          //      if ( fEnergy != fEnergy ) fEnergy = 1.;
1013          //
1014        } else {
1015          //
1016          // if the event is not in the acceptance, return a negative energy.
1017          //
1018          if ( debug ) printf(" Outside acceptance \n");
1019          fEnergy *= -1.;
1020          //
1021        };
1022      //      //
1023    } else {    } else {
1024      //      //

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

  ViewVC Help
Powered by ViewVC 1.1.23