/[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.7 by mocchiut, Mon Dec 3 13:57:11 2007 UTC revision 1.16 by mocchiut, Mon Dec 14 14:31:55 2009 UTC
# Line 36  CaloPreSampler::CaloPreSampler(PamLevel2 Line 36  CaloPreSampler::CaloPreSampler(PamLevel2
36    sel = true;    sel = true;
37    cont = false;    cont = false;
38    emulate18 = true;    emulate18 = true;
39      usepl18x = false;
40    simulation = false;    simulation = false;
41    withtrk = true;    withtrk = true;
42    rigdefault = 50.;    rigdefault = 50.;
43    nox = false;    nox = false;
44    noy = false;    noy = false;
45      forcecalo = false;
46      forcefitmode = -1;
47      memset(mask,0,2*22*sizeof(Int_t));
48    //    //
49    Clear();    Clear();
50    //    //
# Line 69  CaloPreSampler::CaloPreSampler(PamLevel2 Line 73  CaloPreSampler::CaloPreSampler(PamLevel2
73    //    //
74  }  }
75    
76    CaloTrkVar* CaloPreSampler::GetCaloTrack(Int_t t){
77      this->Process();
78      if ( t < 0 ) return pcalo->GetCaloStoredTrack(t);
79      if ( L2->GetTrack(t) ){
80        return pcalo->GetCaloStoredTrack(L2->GetTrack(t)->GetTrkTrack()->GetSeqNo());
81      };
82      return NULL;
83    }
84    
85  void CaloPreSampler::SetNoWpreSampler(Int_t n){  void CaloPreSampler::SetNoWpreSampler(Int_t n){
86    if ( NC+n < 23 ){    if ( NC+n < 23 ){
87      N = n;      N = n;
# Line 93  void CaloPreSampler::SetNoWcalo(Int_t n) Line 106  void CaloPreSampler::SetNoWcalo(Int_t n)
106    };    };
107  }  }
108    
109    void CaloPreSampler::SplitInto(Int_t NoWpreSampler, Int_t NoWcalo){
110      this->SetNoWcalo(0);
111      this->SetNoWpreSampler(0);
112      if ( NoWpreSampler < NoWcalo ){
113            this->SetNoWpreSampler(NoWpreSampler);
114            this->SetNoWcalo(NoWcalo);
115      } else {
116            this->SetNoWcalo(NoWcalo);
117            this->SetNoWpreSampler(NoWpreSampler);
118      };
119    }
120    
121  void CaloPreSampler::Clear(){  void CaloPreSampler::Clear(){
122    //    //
123    pcalo->Clear();    pcalo->Clear();
# Line 136  void CaloPreSampler::Process(){ Line 161  void CaloPreSampler::Process(){
161      return;      return;
162    };    };
163    //    //
164      // Clear structures used to communicate with fortran
165      //
166      event->ClearStructs();//ELENA
167      if ( forcefitmode > 0 ){
168        if ( forcefitmode != 1000 && forcefitmode != 1001 && forcefitmode != 1002 ){
169          printf(" ERROR! forcefitmode=%i \n Use forcefitmode = 1000 for fit mode 0, 1001 fit mode 1, 1002 fit mode 3\n",forcefitmode);
170          forcefitmode = -1;
171        } else {
172          event->clevel2->fmode[0] = forcefitmode;
173          event->clevel2->fmode[1] = forcefitmode;
174        };
175      };
176      //
177    Bool_t newentry = false;    Bool_t newentry = false;
178    //    //
179    if ( L2->IsORB() ){    if ( L2->IsORB() ){
180        if ( debug ) printf(" I am here, we have orbital infos \n");
181      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 ){
182        newentry = true;        newentry = true;
183        OBT = L2->GetOrbitalInfo()->OBT;        OBT = L2->GetOrbitalInfo()->OBT;
# Line 197  void CaloPreSampler::Process(){ Line 236  void CaloPreSampler::Process(){
236      //      //
237      mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip);      mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip);
238      //      //
239        if ( !usepl18x && view==0 && plane==18 ) mip = 0.;
240        //
241      // 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)
242      //      //
243        if ( mask[view][plane] ) mip = 0.;
244      if ( nox && view == 0 ) mip = 0.;      if ( nox && view == 0 ) mip = 0.;
245      if ( noy && view == 1 ) mip = 0.;      if ( noy && view == 1 ) mip = 0.;
246      //      //
247        if ( emulate18 && view == 0 && plane == 18 ) mip = 0.;
248        //
249      // 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
250      //                 included so plane < (22 - 2)      //                 included so plane < (22 - 2)
251      //      //
252      if ( sel ){      if ( sel ){
253        if ( plane < (22 - N) ){        if ( plane < (22 - N) ){
254          //          //
255          if ( emulate18 && plane == (18 - N) ) mip = 0.;          if ( emulate18 && plane == (18 - N) && view == 0 ) mip = 0.;
256          if ( plane >= NC ) mip = 0.;          if ( plane >= NC ) mip = 0.;
257          event->clevel1->estrip[strip][plane][view] = mip;          event->clevel1->estrip[strip][plane][view] = mip;
258          //          //
# Line 220  void CaloPreSampler::Process(){ Line 264  void CaloPreSampler::Process(){
264      if ( cont ){      if ( cont ){
265        if ( plane >= N ){        if ( plane >= N ){
266          //          //
267          if ( emulate18 && plane == (18 + N) ) mip = 0.;          if ( emulate18 && plane == (18 + N) && view == 0 ) mip = 0.;
268          if ( (plane-N) >= NC ) mip = 0.;          if ( (plane-N) >= NC ) mip = 0.;
269          event->clevel1->estrip[strip][(plane-N)][view] = mip;          event->clevel1->estrip[strip][(plane-N)][view] = mip;
270          //          //
# Line 357  void CaloPreSampler::Process(){ Line 401  void CaloPreSampler::Process(){
401    // conditions are: 0) no track from the tracker 1) we have a track fit both in x and y 2) no problems with calo for this event 3) no selftrigger event    // conditions are: 0) no track from the tracker 1) we have a track fit both in x and y 2) no problems with calo for this event 3) no selftrigger event
402    //    //
403    //  if ( trackanyway && !filled && event->clevel2->npcfit[0] >= 2 && event->clevel2->npcfit[1] >= 2 && event->clevel2->good != 0 && event->clevel2->trigty < 2. ){    //  if ( trackanyway && !filled && event->clevel2->npcfit[0] >= 2 && event->clevel2->npcfit[1] >= 2 && event->clevel2->good != 0 && event->clevel2->trigty < 2. ){
404    if ( trackanyway && m3 ){    if ( (trackanyway && m3) || forcecalo ){
405      if ( debug ) printf(" Event with a track not fitted by the tracker \n");      if ( debug ) printf(" Event with a track not fitted by the tracker \n");
406      //      //
407      // Disable "track mode" in the fortran routine      // Disable "track mode" in the fortran routine
# Line 489  void CaloPreSampler::Process(){ Line 533  void CaloPreSampler::Process(){
533        if ( debug ) printf(" Selftrigger: problems with event \n");        if ( debug ) printf(" Selftrigger: problems with event \n");
534      };      };
535    };    };
536    //  //   //
537    // Clear structures used to communicate with fortran  //   // Clear structures used to communicate with fortran
538    //  //   //
539    event->ClearStructs();  //   event->ClearStructs();
540    // ELENA: moved @ beginning
541    //    //
542    //    //
543    //    //
# Line 500  void CaloPreSampler::Process(){ Line 545  void CaloPreSampler::Process(){
545    if ( debug ) printf(" exit \n");    if ( debug ) printf(" exit \n");
546    //    //
547  }  }
548    
549    //
550    // Method to add a calorimeter track, evaluated around a tracker track defined by a status vector.
551    // (can be used to evaluate the calorimeter track around an arbitrary axis, by setting the status vector with zero deflection )
552    //
553    //
554    CaloTrkVar* CaloPreSampler::AddCaloTrkVar(float *al,int trktag){
555    
556        int ntrkentry = pcalo->ntrk();
557        //
558        for (Int_t nt=0; nt < ntrkentry; nt++){  
559            if( pcalo->GetCaloTrkVar(nt)->trkseqno == trktag){
560                cout << " CaloTrkVar* CaloPreSampler::AddCaloTrkVar(float *al,int trktag)"<<endl;
561                cout << " --> trktag = "<<trktag<<" already defined "<<endl;
562                return NULL;
563            }
564        }
565        //
566        event->clevel1->good2 = 1; //is a trk track
567        event->clevel1->trkchi2 = 0;
568        event->clevel1->hzn = 0;
569        //
570        // Copy the alpha vector in the input structure
571        //
572        for (Int_t e = 0; e < 5 ; e++){
573            event->clevel1->al_p[e][0] = al[e];
574        };    
575        //
576        // Get tracker related variables for this track
577        //
578        if ( debug ) printf("track %i Call GetTrkVar() \n",trktag);
579        event->GetTrkVar();
580        if ( debug ) printf(" event->clevel2->dX0l %f \n",event->clevel2->dX0l);
581        //
582        // Save tracker track sequence number
583        //  
584        event->trkseqno = trktag;
585        //
586        // Copy values in the class ca from the structure clevel2
587        //
588        if ( debug ) printf("track %i Call FillTrkVar() \n",trktag);
589        event->FillTrkVar(pcalo,ntrkentry);
590    
591        return pcalo->GetCaloTrkVar(ntrkentry);
592        
593    
594    };//ELENA

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.23