/[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.13 by mocchiut, Mon Jul 27 13:58:58 2009 UTC
# Line 41  CaloPreSampler::CaloPreSampler(PamLevel2 Line 41  CaloPreSampler::CaloPreSampler(PamLevel2
41    rigdefault = 50.;    rigdefault = 50.;
42    nox = false;    nox = false;
43    noy = false;    noy = false;
44      forcecalo = false;
45      forcefitmode = -1;
46      memset(mask,0,2*22*sizeof(Int_t));
47    //    //
48    Clear();    Clear();
49    //    //
# Line 93  void CaloPreSampler::SetNoWcalo(Int_t n) Line 96  void CaloPreSampler::SetNoWcalo(Int_t n)
96    };    };
97  }  }
98    
99    void CaloPreSampler::SplitInto(Int_t NoWpreSampler, Int_t NoWcalo){
100      this->SetNoWcalo(0);
101      this->SetNoWpreSampler(0);
102      if ( NoWpreSampler < NoWcalo ){
103            this->SetNoWpreSampler(NoWpreSampler);
104            this->SetNoWcalo(NoWcalo);
105      } else {
106            this->SetNoWcalo(NoWcalo);
107            this->SetNoWpreSampler(NoWpreSampler);
108      };
109    }
110    
111  void CaloPreSampler::Clear(){  void CaloPreSampler::Clear(){
112    //    //
113    pcalo->Clear();    pcalo->Clear();
# Line 136  void CaloPreSampler::Process(){ Line 151  void CaloPreSampler::Process(){
151      return;      return;
152    };    };
153    //    //
154      // Clear structures used to communicate with fortran
155      //
156      event->ClearStructs();//ELENA
157      if ( forcefitmode > 0 ){
158        if ( forcefitmode != 1000 && forcefitmode != 1001 && forcefitmode != 1002 ){
159          printf(" ERROR! forcefitmode=%i \n Use forcefitmode = 1000 for fit mode 0, 1001 fit mode 1, 1002 fit mode 3\n",forcefitmode);
160          forcefitmode = -1;
161        } else {
162          event->clevel2->fmode[0] = forcefitmode;
163          event->clevel2->fmode[1] = forcefitmode;
164        };
165      };
166      //
167    Bool_t newentry = false;    Bool_t newentry = false;
168    //    //
169    if ( L2->IsORB() ){    if ( L2->IsORB() ){
# Line 199  void CaloPreSampler::Process(){ Line 227  void CaloPreSampler::Process(){
227      //      //
228      // 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)
229      //      //
230        if ( mask[view][plane] ) mip = 0.;
231      if ( nox && view == 0 ) mip = 0.;      if ( nox && view == 0 ) mip = 0.;
232      if ( noy && view == 1 ) mip = 0.;      if ( noy && view == 1 ) mip = 0.;
233      //      //
234        if ( emulate18 && view == 0 && plane == 18 ) mip = 0.;
235        //
236      // 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
237      //                 included so plane < (22 - 2)      //                 included so plane < (22 - 2)
238      //      //
239      if ( sel ){      if ( sel ){
240        if ( plane < (22 - N) ){        if ( plane < (22 - N) ){
241          //          //
242          if ( emulate18 && plane == (18 - N) ) mip = 0.;          if ( emulate18 && plane == (18 - N) && view == 0 ) mip = 0.;
243          if ( plane >= NC ) mip = 0.;          if ( plane >= NC ) mip = 0.;
244          event->clevel1->estrip[strip][plane][view] = mip;          event->clevel1->estrip[strip][plane][view] = mip;
245          //          //
# Line 220  void CaloPreSampler::Process(){ Line 251  void CaloPreSampler::Process(){
251      if ( cont ){      if ( cont ){
252        if ( plane >= N ){        if ( plane >= N ){
253          //          //
254          if ( emulate18 && plane == (18 + N) ) mip = 0.;          if ( emulate18 && plane == (18 + N) && view == 0 ) mip = 0.;
255          if ( (plane-N) >= NC ) mip = 0.;          if ( (plane-N) >= NC ) mip = 0.;
256          event->clevel1->estrip[strip][(plane-N)][view] = mip;          event->clevel1->estrip[strip][(plane-N)][view] = mip;
257          //          //
# Line 357  void CaloPreSampler::Process(){ Line 388  void CaloPreSampler::Process(){
388    // 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
389    //    //
390    //  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. ){
391    if ( trackanyway && m3 ){    if ( (trackanyway && m3) || forcecalo ){
392      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");
393      //      //
394      // Disable "track mode" in the fortran routine      // Disable "track mode" in the fortran routine
# Line 489  void CaloPreSampler::Process(){ Line 520  void CaloPreSampler::Process(){
520        if ( debug ) printf(" Selftrigger: problems with event \n");        if ( debug ) printf(" Selftrigger: problems with event \n");
521      };      };
522    };    };
523    //  //   //
524    // Clear structures used to communicate with fortran  //   // Clear structures used to communicate with fortran
525    //  //   //
526    event->ClearStructs();  //   event->ClearStructs();
527    // ELENA: moved @ beginning
528    //    //
529    //    //
530    //    //
# Line 500  void CaloPreSampler::Process(){ Line 532  void CaloPreSampler::Process(){
532    if ( debug ) printf(" exit \n");    if ( debug ) printf(" exit \n");
533    //    //
534  }  }
535    
536    //
537    // Method to add a calorimeter track, evaluated around a tracker track defined by a status vector.
538    // (can be used to evaluate the calorimeter track around an arbitrary axis, by setting the status vector with zero deflection )
539    //
540    //
541    CaloTrkVar* CaloPreSampler::AddCaloTrkVar(float *al,int trktag){
542    
543        int ntrkentry = pcalo->ntrk();
544        //
545        for (Int_t nt=0; nt < ntrkentry; nt++){  
546            if( pcalo->GetCaloTrkVar(nt)->trkseqno == trktag){
547                cout << " CaloTrkVar* CaloPreSampler::AddCaloTrkVar(float *al,int trktag)"<<endl;
548                cout << " --> trktag = "<<trktag<<" already defined "<<endl;
549                return NULL;
550            }
551        }
552        //
553        event->clevel1->good2 = 1; //is a trk track
554        event->clevel1->trkchi2 = 0;
555        event->clevel1->hzn = 0;
556        //
557        // Copy the alpha vector in the input structure
558        //
559        for (Int_t e = 0; e < 5 ; e++){
560            event->clevel1->al_p[e][0] = al[e];
561        };    
562        //
563        // Get tracker related variables for this track
564        //
565        if ( debug ) printf("track %i Call GetTrkVar() \n",trktag);
566        event->GetTrkVar();
567        if ( debug ) printf(" event->clevel2->dX0l %f \n",event->clevel2->dX0l);
568        //
569        // Save tracker track sequence number
570        //  
571        event->trkseqno = trktag;
572        //
573        // Copy values in the class ca from the structure clevel2
574        //
575        if ( debug ) printf("track %i Call FillTrkVar() \n",trktag);
576        event->FillTrkVar(pcalo,ntrkentry);
577    
578        return pcalo->GetCaloTrkVar(ntrkentry);
579        
580    
581    };//ELENA

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

  ViewVC Help
Powered by ViewVC 1.1.23