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

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

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

revision 1.12 by pam-fi, Tue Feb 24 09:18:05 2009 UTC revision 1.19 by mocchiut, Thu Jan 23 11:23:54 2014 UTC
# Line 14  CaloPreSampler::CaloPreSampler(){ Line 14  CaloPreSampler::CaloPreSampler(){
14    Clear();    Clear();
15  }  }
16    
17    void CaloPreSampler::SetCaloLevel2Pointer(CaloLevel2 *cl2p){
18      if ( pcalo ) delete pcalo;
19      pcalo = cl2p;
20    }
21    
22  CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){    CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){  
23    //    //
24    L2 = l2p;    L2 = l2p;
# Line 36  CaloPreSampler::CaloPreSampler(PamLevel2 Line 41  CaloPreSampler::CaloPreSampler(PamLevel2
41    sel = true;    sel = true;
42    cont = false;    cont = false;
43    emulate18 = true;    emulate18 = true;
44      usepl18x = false;
45    simulation = false;    simulation = false;
46    withtrk = true;    withtrk = true;
47    rigdefault = 50.;    rigdefault = 50.;
48    nox = false;    nox = false;
49    noy = false;    noy = false;
50    forcecalo = false;    forcecalo = false;
51      forcefitmode = -1;
52    memset(mask,0,2*22*sizeof(Int_t));    memset(mask,0,2*22*sizeof(Int_t));
53    //    //
54    Clear();    Clear();
# Line 71  CaloPreSampler::CaloPreSampler(PamLevel2 Line 78  CaloPreSampler::CaloPreSampler(PamLevel2
78    //    //
79  }  }
80    
81    CaloTrkVar* CaloPreSampler::GetCaloTrack(Int_t t){
82      this->Process();
83      if ( t < 0 ) return pcalo->GetCaloStoredTrack(t);
84      if ( L2->GetTrack(t) ){
85        return pcalo->GetCaloStoredTrack(L2->GetTrack(t)->GetTrkTrack()->GetSeqNo());
86      };
87      return NULL;
88    }
89    
90  void CaloPreSampler::SetNoWpreSampler(Int_t n){  void CaloPreSampler::SetNoWpreSampler(Int_t n){
91    if ( NC+n < 23 ){    if ( NC+n < 23 ){
92      N = n;      N = n;
# Line 153  void CaloPreSampler::Process(){ Line 169  void CaloPreSampler::Process(){
169    // Clear structures used to communicate with fortran    // Clear structures used to communicate with fortran
170    //    //
171    event->ClearStructs();//ELENA    event->ClearStructs();//ELENA
172      if ( forcefitmode > 0 ){
173        if ( forcefitmode != 1000 && forcefitmode != 1001 && forcefitmode != 1002 ){
174          printf(" ERROR! forcefitmode=%i \n Use forcefitmode = 1000 for fit mode 0, 1001 fit mode 1, 1002 fit mode 3\n",forcefitmode);
175          forcefitmode = -1;
176        } else {
177          event->clevel2->fmode[0] = forcefitmode;
178          event->clevel2->fmode[1] = forcefitmode;
179        };
180      };
181    //    //
182    Bool_t newentry = false;    Bool_t newentry = false;
183    //    //
184    if ( L2->IsORB() ){    if ( L2->IsORB() ){
185        if ( debug ) printf(" I am here, we have orbital infos \n");
186      if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime || sel != ssel ){      if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime || sel != ssel ){
187        newentry = true;        newentry = true;
188        OBT = L2->GetOrbitalInfo()->OBT;        OBT = L2->GetOrbitalInfo()->OBT;
# Line 184  void CaloPreSampler::Process(){ Line 210  void CaloPreSampler::Process(){
210    Bool_t st = true;    Bool_t st = true;
211    Int_t ntrkentry = 0;    Int_t ntrkentry = 0;
212    TrkLevel2 *trk = L2->GetTrkLevel2();    TrkLevel2 *trk = L2->GetTrkLevel2();
213    Bool_t filled = false;    //  Bool_t filled = false;
214    //    //
215    if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime);    if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime);
216    //    //
   this->Clear();  
   //  
217    // find out if we have trkseqno = -1, -2 or -3    // find out if we have trkseqno = -1, -2 or -3
218    //    //
219    Bool_t m1 = false;    Bool_t m1 = false;
# Line 202  void CaloPreSampler::Process(){ Line 226  void CaloPreSampler::Process(){
226    };    };
227    if ( !withtrk ) m3 = true;    if ( !withtrk ) m3 = true;
228    //    //
229      // copy variables calculated during calibration process which is skipped here... this has been moved before this->Clear() for reprocessing purpose
230      //
231      event->clevel2->good = L2->GetCaloLevel2()->good;
232      memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr));
233      memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr));
234      memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc));
235      event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger;
236      //
237      //
238      this->Clear(); // moved after all calls to L2->GetCaloLevel2() since pcalo could be the same as L2->GetCaloLevel2() !!!
239      //
240      //
241    if ( debug ) printf(" Fill estrip matrix needed to calculate variables \n");    if ( debug ) printf(" Fill estrip matrix needed to calculate variables \n");
242    //    //
243    // Fill the estrip matrix    // Fill the estrip matrix
# Line 215  void CaloPreSampler::Process(){ Line 251  void CaloPreSampler::Process(){
251      //      //
252      mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip);      mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip);
253      //      //
254        if ( !usepl18x && view==0 && plane==18 ) mip = 0.;
255        //
256      // Mask x or y view if nox and/or noy are true (default false)      // Mask x or y view if nox and/or noy are true (default false)
257      //      //
258      if ( mask[view][plane] ) mip = 0.;      if ( mask[view][plane] ) mip = 0.;
# Line 307  void CaloPreSampler::Process(){ Line 345  void CaloPreSampler::Process(){
345    //    //
346    event->clevel1->good2 = 1;    event->clevel1->good2 = 1;
347    //    //
348    // copy variables calculated during calibration process which is skipped here...    // copy variables calculated during calibration process which is skipped here... this has to be moved before this->Clear() for reprocessing purpose
349    //    //
350    event->clevel2->good = L2->GetCaloLevel2()->good;  //  event->clevel2->good = L2->GetCaloLevel2()->good;
351    memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr));  //  memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr));
352    memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr));  //  memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr));
353    memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc));  //  memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc));
354    event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger;  //  event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger;
355    //    //
356    // Calculate variables common to all tracks (qtot, nstrip, etc.)    // Calculate variables common to all tracks (qtot, nstrip, etc.)
357    //    //
# Line 329  void CaloPreSampler::Process(){ Line 367  void CaloPreSampler::Process(){
367    //    //
368    ntrkentry = 0;    ntrkentry = 0;
369    //    //
370    filled = false;    //  filled = false;
371    //    //
372    // Run over tracks (tracker or calorimeter )    // Run over tracks (tracker or calorimeter )
373    //    //
# Line 366  void CaloPreSampler::Process(){ Line 404  void CaloPreSampler::Process(){
404    
405    
406        ntrkentry++;              ntrkentry++;      
407        filled = true;        //      filled = true;
408        //        //
409      }; // loop on all the tracks      }; // loop on all the tracks
410    };    };
# Line 411  void CaloPreSampler::Process(){ Line 449  void CaloPreSampler::Process(){
449        if ( debug ) printf("-3 a Call FillTrkVar() \n");        if ( debug ) printf("-3 a Call FillTrkVar() \n");
450        event->FillTrkVar(pcalo,ntrkentry);        event->FillTrkVar(pcalo,ntrkentry);
451        ntrkentry++;        ntrkentry++;
452        filled = true;        //      filled = true;
453        //        //
454      } else {      } else {
455        if ( debug ) printf(" Selftrigger: problems with event \n");        if ( debug ) printf(" Selftrigger: problems with event \n");
# Line 458  void CaloPreSampler::Process(){ Line 496  void CaloPreSampler::Process(){
496        if ( debug ) printf("-2 a Call FillTrkVar() \n");        if ( debug ) printf("-2 a Call FillTrkVar() \n");
497        event->FillTrkVar(pcalo,ntrkentry);        event->FillTrkVar(pcalo,ntrkentry);
498        ntrkentry++;        ntrkentry++;
499        filled = true;        //      filled = true;
500        //        //
501      } else {      } else {
502        if ( debug ) printf(" Selftrigger: problems with event \n");        if ( debug ) printf(" Selftrigger: problems with event \n");
# Line 504  void CaloPreSampler::Process(){ Line 542  void CaloPreSampler::Process(){
542        if ( debug ) printf("-1 a Call FillTrkVar() \n");        if ( debug ) printf("-1 a Call FillTrkVar() \n");
543        event->FillTrkVar(pcalo,ntrkentry);        event->FillTrkVar(pcalo,ntrkentry);
544        ntrkentry++;        ntrkentry++;
545        filled = true;        //      filled = true;
546        //        //
547      } else {      } else {
548        if ( debug ) printf(" Selftrigger: problems with event \n");        if ( debug ) printf(" Selftrigger: problems with event \n");

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.23