/[PAMELA software]/DarthVader/CalorimeterLevel2/src/CaloLevel2.cpp
ViewVC logotype

Diff of /DarthVader/CalorimeterLevel2/src/CaloLevel2.cpp

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

revision 1.10 by pam-fi, Thu Jan 11 09:32:54 2007 UTC revision 1.14 by mocchiut, Mon Sep 3 08:42:13 2007 UTC
# Line 92  CaloLevel2::CaloLevel2() {     Line 92  CaloLevel2::CaloLevel2() {    
92    this->Clear();    this->Clear();
93    //    //
94  };  };
95    /**
96     * Create the TClonesArray
97    **/
98    void CaloLevel2::Set(){//ELENA
99        if(!CaloTrk)CaloTrk = new TClonesArray("CaloTrkVar",1); //ELENA
100    }//ELENA
101    
102  /**  /**
103   * Clear the CaloLevel2 object   * Clear the CaloLevel2 object
# Line 103  void CaloLevel2::Clear() {     Line 109  void CaloLevel2::Clear() {    
109    //    //
110    nstrip = 0;    nstrip = 0;
111    qtot = 0.;    qtot = 0.;
112    impx = 0.;    //  impx = 0.;
113    impy = 0.;    //  impy = 0.;
   tanx = 0.;  
   tany = 0.;  
114    qmax = 0.;    qmax = 0.;
115    nx22 = 0;    nx22 = 0;
116    qx22 = 0.;    qx22 = 0.;
# Line 116  void CaloLevel2::Clear() {     Line 120  void CaloLevel2::Clear() {    
120    memset(swerr, 0, 4*sizeof(Int_t));    memset(swerr, 0, 4*sizeof(Int_t));
121    memset(crc, 0, 4*sizeof(Int_t));    memset(crc, 0, 4*sizeof(Int_t));
122    memset(qq, 0, 4*sizeof(Int_t));    memset(qq, 0, 4*sizeof(Int_t));
123    memset(varcfit, 0, 2*sizeof(Float_t));    memset(varcfit, 0, 4*sizeof(Float_t));
124    memset(npcfit, 0, 2*sizeof(Int_t));    memset(npcfit, 0, 4*sizeof(Int_t));
125      memset(tanx, 0, 2*sizeof(Int_t));
126      memset(tany, 0, 2*sizeof(Int_t));
127      memset(fitmode, 0, 2*sizeof(Int_t));
128    memset(planemax, 0, 2*sizeof(Int_t));    memset(planemax, 0, 2*sizeof(Int_t));
129      memset(selfdelay, 0, 4*7*sizeof(Int_t));
130    memset(cibar, 0, 2*22*sizeof(Int_t));    memset(cibar, 0, 2*22*sizeof(Int_t));
131    memset(cbar, 0, 2*22*sizeof(Float_t));    memset(cbar, 0, 2*22*sizeof(Float_t));
132    good = 0;    good = 0;
# Line 148  void CaloLevel2::GetLevel2Struct(cCaloLe Line 156  void CaloLevel2::GetLevel2Struct(cCaloLe
156    l2->qtot = qtot;        l2->qtot = qtot;    
157    l2->qx22 = qx22;        l2->qx22 = qx22;    
158    l2->qmax = qmax;        l2->qmax = qmax;    
159    l2->impx = impx;        //  l2->impx = impx;    
160    l2->impy = impy;        //  l2->impy = impy;    
161    l2->tanx = tanx;        //  l2->tanx = tanx;    
162    l2->tany = tany;      //  l2->tany = tany;  
163    l2->elen = elen;          l2->elen = elen;      
164    l2->selen = selen;    l2->selen = selen;
165                    
# Line 204  void CaloLevel2::GetLevel2Struct(cCaloLe Line 212  void CaloLevel2::GetLevel2Struct(cCaloLe
212  }  }
213    
214  /**  /**
215     * Returns the impact position on the top of the calorimeter as determined by the calorimeter itself.
216     * @param tr : if tr = 0 use the calorimeter "normal" fit, if 1 use the calorimeter "selftrigger" fit (if any!)
217    **/
218    Float_t CaloLevel2::impx(Int_t tr){
219      if ( tr == 0 ) return(cbar[0][0]);
220      if ( tr == 1 ) {
221        if ( !CaloTrk ) return(-110.);
222        TClonesArray &t = *(CaloTrk);
223        for (Int_t itrk=0; itrk<ntrk(); itrk++){
224          CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];
225          if ( calotrack->trkseqno == -1 ) return(calotrack->tbar[0][0]);
226        };
227      };
228      if ( tr !=0 && tr !=1 ){
229        printf(" Cannot get impx for other than calo or selftrigger tracks!\n");
230      } else {
231        printf(" Cannot find selftrigger block\n");
232      };
233      return(-100.);
234    };
235    
236    /**
237     * Returns the impact position on the top of the calorimeter as determined by the calorimeter itself.
238     * @param tr : if tr = 0 use the calorimeter "normal" fit, if 1 use the calorimeter "selftrigger" fit (if any!)
239    **/
240    Float_t CaloLevel2::impy(Int_t tr){
241      if ( tr == 0 ) return(cbar[0][1]);
242      if ( tr == 1 ) {
243        if ( !CaloTrk ) return(-110.);
244        TClonesArray &t = *(CaloTrk);
245        for (Int_t itrk=0; itrk<ntrk(); itrk++){
246          CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];
247          if ( calotrack->trkseqno == -1 ) return(calotrack->tbar[0][1]);
248        };
249      };
250      if ( tr !=0 && tr !=1 ){
251        printf(" Cannot get impy for other than calo or selftrigger tracks!\n");
252      } else {
253        printf(" Cannot find selftrigger block\n");
254      };
255      return(-100.);
256    };
257    /**
258   * Should return the energy in GeV if the particle would be an electron   * Should return the energy in GeV if the particle would be an electron
259   * using a parametrization taken from Monte Carlo simulation   * using a parametrization taken from Monte Carlo simulation
260  **/  **/
# Line 230  CaloTrkVar *CaloLevel2::GetCaloTrkVar(In Line 281  CaloTrkVar *CaloLevel2::GetCaloTrkVar(In
281    CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];    CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];
282    return calotrack;    return calotrack;
283  }  }
284    
285    /**
286     * Retrieves the calorimeter track matching the seqno-th tracker stored track.
287     * (If seqno = -1 retrieves the self-trigger calorimeter track)
288     */
289    CaloTrkVar *CaloLevel2::GetCaloStoredTrack(int seqno){
290    
291      if( ntrk()==0 ){
292        printf("CaloLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo %i but no Calorimeter tracks are stored\n",seqno);
293        return NULL;
294      };
295      
296      CaloTrkVar *c = 0;
297      Int_t it_calo=0;
298        
299      do {
300        c = GetCaloTrkVar(it_calo);
301        it_calo++;
302      } while( c && seqno != c->trkseqno && it_calo < ntrk());      
303      
304      if(!c || seqno != c->trkseqno){
305        c = 0;
306        if(seqno!=-1 && seqno !=-2 && seqno!=-3 ) printf("CaloLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo %i does not match Calorimeter stored tracks\n",seqno);
307      };
308      return c;
309        
310    };

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.23