/[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.9 by mocchiut, Mon Apr 7 13:51:52 2008 UTC revision 1.15 by mocchiut, Tue Sep 15 10:19:03 2009 UTC
# Line 42  CaloPreSampler::CaloPreSampler(PamLevel2 Line 42  CaloPreSampler::CaloPreSampler(PamLevel2
42    nox = false;    nox = false;
43    noy = false;    noy = false;
44    forcecalo = false;    forcecalo = false;
45      forcefitmode = -1;
46    memset(mask,0,2*22*sizeof(Int_t));    memset(mask,0,2*22*sizeof(Int_t));
47    //    //
48    Clear();    Clear();
# Line 71  CaloPreSampler::CaloPreSampler(PamLevel2 Line 72  CaloPreSampler::CaloPreSampler(PamLevel2
72    //    //
73  }  }
74    
75    CaloTrkVar* CaloPreSampler::GetCaloTrack(Int_t t){
76      this->Process();
77      if ( t < 0 ) return pcalo->GetCaloStoredTrack(t);
78      if ( L2->GetTrack(t) ){
79        return pcalo->GetCaloStoredTrack(L2->GetTrack(t)->GetTrkTrack()->GetSeqNo());
80      };
81      return NULL;
82    }
83    
84  void CaloPreSampler::SetNoWpreSampler(Int_t n){  void CaloPreSampler::SetNoWpreSampler(Int_t n){
85    if ( NC+n < 23 ){    if ( NC+n < 23 ){
86      N = n;      N = n;
# Line 95  void CaloPreSampler::SetNoWcalo(Int_t n) Line 105  void CaloPreSampler::SetNoWcalo(Int_t n)
105    };    };
106  }  }
107    
108    void CaloPreSampler::SplitInto(Int_t NoWpreSampler, Int_t NoWcalo){
109      this->SetNoWcalo(0);
110      this->SetNoWpreSampler(0);
111      if ( NoWpreSampler < NoWcalo ){
112            this->SetNoWpreSampler(NoWpreSampler);
113            this->SetNoWcalo(NoWcalo);
114      } else {
115            this->SetNoWcalo(NoWcalo);
116            this->SetNoWpreSampler(NoWpreSampler);
117      };
118    }
119    
120  void CaloPreSampler::Clear(){  void CaloPreSampler::Clear(){
121    //    //
122    pcalo->Clear();    pcalo->Clear();
# Line 138  void CaloPreSampler::Process(){ Line 160  void CaloPreSampler::Process(){
160      return;      return;
161    };    };
162    //    //
163      // Clear structures used to communicate with fortran
164      //
165      event->ClearStructs();//ELENA
166      if ( forcefitmode > 0 ){
167        if ( forcefitmode != 1000 && forcefitmode != 1001 && forcefitmode != 1002 ){
168          printf(" ERROR! forcefitmode=%i \n Use forcefitmode = 1000 for fit mode 0, 1001 fit mode 1, 1002 fit mode 3\n",forcefitmode);
169          forcefitmode = -1;
170        } else {
171          event->clevel2->fmode[0] = forcefitmode;
172          event->clevel2->fmode[1] = forcefitmode;
173        };
174      };
175      //
176    Bool_t newentry = false;    Bool_t newentry = false;
177    //    //
178    if ( L2->IsORB() ){    if ( L2->IsORB() ){
179        if ( debug ) printf(" I am here, we have orbital infos \n");
180      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 ){
181        newentry = true;        newentry = true;
182        OBT = L2->GetOrbitalInfo()->OBT;        OBT = L2->GetOrbitalInfo()->OBT;
# Line 205  void CaloPreSampler::Process(){ Line 241  void CaloPreSampler::Process(){
241      if ( nox && view == 0 ) mip = 0.;      if ( nox && view == 0 ) mip = 0.;
242      if ( noy && view == 1 ) mip = 0.;      if ( noy && view == 1 ) mip = 0.;
243      //      //
244        if ( emulate18 && view == 0 && plane == 18 ) mip = 0.;
245        //
246      // Selection mode: fill the matrix only for plane < (22 - N) REMEMBER N = number of W planes to be used as presampler, ie if N = 2 then we want to use planes from 0 to 19      // Selection mode: fill the matrix only for plane < (22 - N) REMEMBER N = number of W planes to be used as presampler, ie if N = 2 then we want to use planes from 0 to 19
247      //                 included so plane < (22 - 2)      //                 included so plane < (22 - 2)
248      //      //
# Line 492  void CaloPreSampler::Process(){ Line 530  void CaloPreSampler::Process(){
530        if ( debug ) printf(" Selftrigger: problems with event \n");        if ( debug ) printf(" Selftrigger: problems with event \n");
531      };      };
532    };    };
533    //  //   //
534    // Clear structures used to communicate with fortran  //   // Clear structures used to communicate with fortran
535    //  //   //
536    event->ClearStructs();  //   event->ClearStructs();
537    // ELENA: moved @ beginning
538    //    //
539    //    //
540    //    //
# Line 503  void CaloPreSampler::Process(){ Line 542  void CaloPreSampler::Process(){
542    if ( debug ) printf(" exit \n");    if ( debug ) printf(" exit \n");
543    //    //
544  }  }
545    
546    //
547    // Method to add a calorimeter track, evaluated around a tracker track defined by a status vector.
548    // (can be used to evaluate the calorimeter track around an arbitrary axis, by setting the status vector with zero deflection )
549    //
550    //
551    CaloTrkVar* CaloPreSampler::AddCaloTrkVar(float *al,int trktag){
552    
553        int ntrkentry = pcalo->ntrk();
554        //
555        for (Int_t nt=0; nt < ntrkentry; nt++){  
556            if( pcalo->GetCaloTrkVar(nt)->trkseqno == trktag){
557                cout << " CaloTrkVar* CaloPreSampler::AddCaloTrkVar(float *al,int trktag)"<<endl;
558                cout << " --> trktag = "<<trktag<<" already defined "<<endl;
559                return NULL;
560            }
561        }
562        //
563        event->clevel1->good2 = 1; //is a trk track
564        event->clevel1->trkchi2 = 0;
565        event->clevel1->hzn = 0;
566        //
567        // Copy the alpha vector in the input structure
568        //
569        for (Int_t e = 0; e < 5 ; e++){
570            event->clevel1->al_p[e][0] = al[e];
571        };    
572        //
573        // Get tracker related variables for this track
574        //
575        if ( debug ) printf("track %i Call GetTrkVar() \n",trktag);
576        event->GetTrkVar();
577        if ( debug ) printf(" event->clevel2->dX0l %f \n",event->clevel2->dX0l);
578        //
579        // Save tracker track sequence number
580        //  
581        event->trkseqno = trktag;
582        //
583        // Copy values in the class ca from the structure clevel2
584        //
585        if ( debug ) printf("track %i Call FillTrkVar() \n",trktag);
586        event->FillTrkVar(pcalo,ntrkentry);
587    
588        return pcalo->GetCaloTrkVar(ntrkentry);
589        
590    
591    };//ELENA

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.23