| 5 | 
 **/ | 
 **/ | 
| 6 | 
 #include <TObject.h> | 
 #include <TObject.h> | 
| 7 | 
 #include <CaloLevel2.h> | 
 #include <CaloLevel2.h> | 
| 8 | 
  | 
  | 
| 9 | 
  | 
 // | 
| 10 | 
 ClassImp(CaloTrkVar); | 
 ClassImp(CaloTrkVar); | 
| 11 | 
 ClassImp(CaloLevel2); | 
 ClassImp(CaloLevel2); | 
| 12 | 
  | 
  | 
| 87 | 
 CaloLevel2::CaloLevel2() {     | 
 CaloLevel2::CaloLevel2() {     | 
| 88 | 
   // | 
   // | 
| 89 | 
   CaloTrk = new TClonesArray("CaloTrkVar",1); | 
   CaloTrk = new TClonesArray("CaloTrkVar",1); | 
 | 
   estrip = TArrayF(0,NULL); | 
  | 
| 90 | 
   // | 
   // | 
| 91 | 
   this->Clear(); | 
   this->Clear(); | 
| 92 | 
   // | 
   // | 
| 93 | 
 }; | 
 }; | 
| 94 | 
  | 
  | 
| 95 | 
  | 
 /** | 
| 96 | 
  | 
  * Clear the CaloLevel2 object | 
| 97 | 
  | 
  **/ | 
| 98 | 
 void CaloLevel2::Clear() {     | 
 void CaloLevel2::Clear() {     | 
| 99 | 
   // | 
   // | 
| 100 | 
   CaloTrk->Clear(); | 
   CaloTrk->Clear(); | 
| 121 | 
   memset(cbar, 0, 2*22*sizeof(Float_t)); | 
   memset(cbar, 0, 2*22*sizeof(Float_t)); | 
| 122 | 
   good = 0; | 
   good = 0; | 
| 123 | 
   selftrigger = 0; | 
   selftrigger = 0; | 
| 124 | 
   estrip.Reset(); | 
   // | 
| 125 | 
 }; | 
 }; | 
| 126 | 
  | 
  | 
| 127 | 
  | 
  | 
| 193 | 
 } | 
 } | 
| 194 | 
  | 
  | 
| 195 | 
 /** | 
 /** | 
| 196 | 
  * Gives the detected energy for the given strip once loaded the event | 
  * Should return the energy in GeV if the particle would be an electron | 
| 197 | 
  | 
  * using a parametrization taken from Monte Carlo simulation | 
| 198 | 
 **/ | 
 **/ | 
 | 
 Float_t CaloLevel2::GetEstrip(Int_t view, Int_t plane, Int_t strip){ | 
  | 
 | 
   Int_t splane = 0; | 
  | 
 | 
   Int_t sstrip = 0; | 
  | 
 | 
   // | 
  | 
 | 
   if ( nstrip == 0 ) return(0.); | 
  | 
 | 
   // | 
  | 
 | 
   for (Int_t i = 0; i<nstrip; i++ ){ | 
  | 
 | 
     if ( view == 0 ){ | 
  | 
 | 
       if ( estrip.At(i) > 0. ){ | 
  | 
 | 
         splane = (Int_t)trunc(estrip.At(i)/1000000.); | 
  | 
 | 
         sstrip = (Int_t)trunc((estrip.At(i)-((Float_t)splane*1000000.))/10000.); | 
  | 
 | 
         if ( splane == plane && sstrip == strip ) return(estrip.At(i)-(Float_t)splane*1000000.-(Float_t)sstrip*10000.); | 
  | 
 | 
       };         | 
  | 
 | 
     } else { | 
  | 
 | 
       if ( estrip.At(i) < 0. ){ | 
  | 
 | 
         splane = (Int_t)trunc(-estrip.At(i)/1000000.); | 
  | 
 | 
         sstrip = (Int_t)trunc((-estrip.At(i)-((Float_t)splane*1000000.))/10000.); | 
  | 
 | 
         if ( splane == plane && sstrip == strip ) return(-estrip.At(i)-(Float_t)splane*1000000.-(Float_t)sstrip*10000.);         | 
  | 
 | 
       };         | 
  | 
 | 
     }; | 
  | 
 | 
   }; | 
  | 
 | 
   return(0.); | 
  | 
 | 
 }; | 
  | 
 | 
  | 
  | 
 | 
 /** | 
  | 
 | 
  * Given estrip entry returns energy and strip | 
  | 
 | 
 **/ | 
  | 
 | 
 Float_t CaloLevel2::DecodeEstrip(Int_t entry, Int_t &view, Int_t &plane, Int_t &strip){ | 
  | 
 | 
   if ( entry>nstrip ) return(0.); | 
  | 
 | 
   // | 
  | 
 | 
   if ( estrip.At(entry) > 0. ){ | 
  | 
 | 
     view = 0; | 
  | 
 | 
     plane = (Int_t)trunc(estrip.At(entry)/1000000.); | 
  | 
 | 
     strip = (Int_t)trunc((estrip.At(entry)-((Float_t)plane*1000000.))/10000.); | 
  | 
 | 
     return(estrip.At(entry)-(Float_t)plane*1000000.-(Float_t)strip*10000.); | 
  | 
 | 
   }; | 
  | 
 | 
   if ( estrip.At(entry) < 0. ){ | 
  | 
 | 
     view = 1; | 
  | 
 | 
     plane = (Int_t)trunc(-estrip.At(entry)/1000000.); | 
  | 
 | 
     strip = (Int_t)trunc((-estrip.At(entry)-((Float_t)plane*1000000.))/10000.); | 
  | 
 | 
     return(-estrip.At(entry)-(Float_t)plane*1000000.-(Float_t)strip*10000.);     | 
  | 
 | 
   };     | 
  | 
 | 
   // | 
  | 
 | 
   printf(" WARNING: problems decoding value %f at entry %i \n",estrip.At(entry),entry); | 
  | 
 | 
   // | 
  | 
 | 
   view = -1; | 
  | 
 | 
   plane = -1; | 
  | 
 | 
   strip = -1; | 
  | 
 | 
   return(0.);   | 
  | 
 | 
 } | 
  | 
 | 
  | 
  | 
| 199 | 
 void CaloLevel2::GetElectronEnergy(Float_t &energy, Float_t &sigma){ | 
 void CaloLevel2::GetElectronEnergy(Float_t &energy, Float_t &sigma){ | 
| 200 | 
   if ( nstrip == 0 ) return; | 
   if ( nstrip == 0 ) return; | 
| 201 | 
   energy = qtot * 40.82 * 0.000106; | 
   energy = qtot * 40.82 * 0.000106; |