/[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.13 by mocchiut, Fri Jul 20 09:13:07 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(cibar, 0, 2*22*sizeof(Int_t));    memset(cibar, 0, 2*22*sizeof(Int_t));
130    memset(cbar, 0, 2*22*sizeof(Float_t));    memset(cbar, 0, 2*22*sizeof(Float_t));
# Line 148  void CaloLevel2::GetLevel2Struct(cCaloLe Line 155  void CaloLevel2::GetLevel2Struct(cCaloLe
155    l2->qtot = qtot;        l2->qtot = qtot;    
156    l2->qx22 = qx22;        l2->qx22 = qx22;    
157    l2->qmax = qmax;        l2->qmax = qmax;    
158    l2->impx = impx;        //  l2->impx = impx;    
159    l2->impy = impy;        //  l2->impy = impy;    
160    l2->tanx = tanx;        //  l2->tanx = tanx;    
161    l2->tany = tany;      //  l2->tany = tany;  
162    l2->elen = elen;          l2->elen = elen;      
163    l2->selen = selen;    l2->selen = selen;
164                    
# Line 204  void CaloLevel2::GetLevel2Struct(cCaloLe Line 211  void CaloLevel2::GetLevel2Struct(cCaloLe
211  }  }
212    
213  /**  /**
214     * Returns the impact position on the top of the calorimeter as determined by the calorimeter itself.
215     * @param tr : if tr = 0 use the calorimeter "normal" fit, if 1 use the calorimeter "selftrigger" fit (if any!)
216    **/
217    Float_t CaloLevel2::impx(Int_t tr){
218      if ( tr == 0 ) return(cbar[0][0]);
219      if ( tr == 1 ) {
220        if ( !CaloTrk ) return(-110.);
221        TClonesArray &t = *(CaloTrk);
222        for (Int_t itrk=0; itrk<ntrk(); itrk++){
223          CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];
224          if ( calotrack->trkseqno == -1 ) return(calotrack->tbar[0][0]);
225        };
226      };
227      if ( tr !=0 && tr !=1 ){
228        printf(" Cannot get impx for other than calo or selftrigger tracks!\n");
229      } else {
230        printf(" Cannot find selftrigger block\n");
231      };
232      return(-100.);
233    };
234    
235    /**
236     * Returns the impact position on the top of the calorimeter as determined by the calorimeter itself.
237     * @param tr : if tr = 0 use the calorimeter "normal" fit, if 1 use the calorimeter "selftrigger" fit (if any!)
238    **/
239    Float_t CaloLevel2::impy(Int_t tr){
240      if ( tr == 0 ) return(cbar[0][1]);
241      if ( tr == 1 ) {
242        if ( !CaloTrk ) return(-110.);
243        TClonesArray &t = *(CaloTrk);
244        for (Int_t itrk=0; itrk<ntrk(); itrk++){
245          CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];
246          if ( calotrack->trkseqno == -1 ) return(calotrack->tbar[0][1]);
247        };
248      };
249      if ( tr !=0 && tr !=1 ){
250        printf(" Cannot get impy for other than calo or selftrigger tracks!\n");
251      } else {
252        printf(" Cannot find selftrigger block\n");
253      };
254      return(-100.);
255    };
256    /**
257   * 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
258   * using a parametrization taken from Monte Carlo simulation   * using a parametrization taken from Monte Carlo simulation
259  **/  **/
# Line 230  CaloTrkVar *CaloLevel2::GetCaloTrkVar(In Line 280  CaloTrkVar *CaloLevel2::GetCaloTrkVar(In
280    CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];    CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk];
281    return calotrack;    return calotrack;
282  }  }
283    
284    /**
285     * Retrieves the calorimeter track matching the seqno-th tracker stored track.
286     * (If seqno = -1 retrieves the self-trigger calorimeter track)
287     */
288    CaloTrkVar *CaloLevel2::GetCaloStoredTrack(int seqno){
289    
290      if( ntrk()==0 ){
291        printf("CaloLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo %i but no Calorimeter tracks are stored\n",seqno);
292        return NULL;
293      };
294      
295      CaloTrkVar *c = 0;
296      Int_t it_calo=0;
297        
298      do {
299        c = GetCaloTrkVar(it_calo);
300        it_calo++;
301      } while( c && seqno != c->trkseqno && it_calo < ntrk());      
302      
303      if(!c || seqno != c->trkseqno){
304        c = 0;
305        if(seqno!=-1 && seqno !=-2 && seqno!=-3 ) printf("CaloLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo %i does not match Calorimeter stored tracks\n",seqno);
306      };
307      return c;
308        
309    };

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

  ViewVC Help
Powered by ViewVC 1.1.23