/[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.1 by mocchiut, Fri Jul 20 08:27:45 2007 UTC revision 1.7 by mocchiut, Mon Dec 3 13:57:11 2007 UTC
# Line 12  Line 12 
12   */   */
13  CaloPreSampler::CaloPreSampler(){  CaloPreSampler::CaloPreSampler(){
14    Clear();    Clear();
15  };  }
16    
17  CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){    CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){  
18    //    //
# Line 30  CaloPreSampler::CaloPreSampler(PamLevel2 Line 30  CaloPreSampler::CaloPreSampler(PamLevel2
30    cstrip = new CaloStrip(false);    cstrip = new CaloStrip(false);
31    //  c1 = new CaloLevel1();    //  c1 = new CaloLevel1();
32    pcalo = new CaloLevel2();    pcalo = new CaloLevel2();
33    N = 3;    N = 4;
34      NC = 22-N;
35    debug = false;    debug = false;
36    sel = true;    sel = true;
37    cont = false;    cont = false;
38    emulate18 = true;    emulate18 = true;
39    simulation = false;    simulation = false;
40      withtrk = true;
41      rigdefault = 50.;
42      nox = false;
43      noy = false;
44    //    //
45    Clear();    Clear();
46    //    //
# Line 62  CaloPreSampler::CaloPreSampler(PamLevel2 Line 67  CaloPreSampler::CaloPreSampler(PamLevel2
67    printf(" Reading magnetic field maps at %s\n",(q4->PATH+q4->NAME).Data());    printf(" Reading magnetic field maps at %s\n",(q4->PATH+q4->NAME).Data());
68    trk->LoadField(q4->PATH+q4->NAME);    trk->LoadField(q4->PATH+q4->NAME);
69    //    //
70  };  }
71    
72    void CaloPreSampler::SetNoWpreSampler(Int_t n){
73      if ( NC+n < 23 ){
74        N = n;
75      } else {
76        printf(" ERROR! Calorimeter is made of 22 W planes\n");
77        printf(" you are giving N presampler = %i and N calo = %i \n",n,NC);
78        printf(" WARNING: using default values NWpre = 4, NWcalo = 18\n");
79        NC = 18;
80        N = 4;
81      };
82    }
83    
84    void CaloPreSampler::SetNoWcalo(Int_t n){
85      if ( N+n < 23 ){
86        NC = n;
87      } else {
88        printf(" ERROR! Calorimeter is made of 22 W planes\n");
89        printf(" you are giving N W presampler = %i and N W calo = %i \n",N,n);
90        printf(" WARNING: using default values NWpre = 4, NWcalo = 18\n");
91        NC = 18;
92        N = 4;
93      };
94    }
95    
96  void CaloPreSampler::Clear(){  void CaloPreSampler::Clear(){
97    //    //
98    pcalo->Clear();    pcalo->Clear();
99    //    //
100  };  }
101    
102  void CaloPreSampler::Print(){  void CaloPreSampler::Print(){
103    //    //
# Line 84  void CaloPreSampler::Print(){ Line 113  void CaloPreSampler::Print(){
113    printf(" pre-sampler planes               :.. %i\n",N);    printf(" pre-sampler planes               :.. %i\n",N);
114    printf(" pcalo->qtot                      :.. %f\n",pcalo->qtot);    printf(" pcalo->qtot                      :.. %f\n",pcalo->qtot);
115    printf(" pcalo->nstrip                    :.. %i\n",pcalo->nstrip);      printf(" pcalo->nstrip                    :.. %i\n",pcalo->nstrip);  
116    printf(" pcalo->track0->qtrack            :.. %f\n",pcalo->GetCaloTrkVar(0)->qtrack);      if ( pcalo->ntrk() > 0 ){
117    printf(" pcalo->track0->dX0l              :.. %f\n",pcalo->GetCaloTrkVar(0)->dX0l);        printf(" pcalo->track0->qtrack            :.. %f\n",pcalo->GetCaloTrkVar(0)->qtrack);  
118        printf(" pcalo->track0->dX0l              :.. %f\n",pcalo->GetCaloTrkVar(0)->dX0l);  
119      };
120    printf("========================================================================\n");    printf("========================================================================\n");
121    //    //
122  };  }
123    
124  void CaloPreSampler::Delete(){  void CaloPreSampler::Delete(){
125    Clear();    Clear();
126    delete pcalo;    delete pcalo;
127    //delete this;    //delete this;
128  };  }
129    
130    
131  void CaloPreSampler::Process(){  void CaloPreSampler::Process(){
# Line 129  void CaloPreSampler::Process(){ Line 160  void CaloPreSampler::Process(){
160    Int_t S11 = 0;    Int_t S11 = 0;
161    Float_t tmptrigty = -1.;    Float_t tmptrigty = -1.;
162    Bool_t trackanyway = true;    Bool_t trackanyway = true;
163    Float_t rigdefault = 50.;    //  Float_t rigdefault = 50.;
164    Bool_t hZn = true;    Bool_t hZn = true;
165    Bool_t withtrk = true;    //  Bool_t withtrk = true;
166    Bool_t st = true;    Bool_t st = true;
167    Int_t ntrkentry = 0;    Int_t ntrkentry = 0;
168    TrkLevel2 *trk = L2->GetTrkLevel2();    TrkLevel2 *trk = L2->GetTrkLevel2();
# Line 151  void CaloPreSampler::Process(){ Line 182  void CaloPreSampler::Process(){
182      if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -2 ) m2 = true;      if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -2 ) m2 = true;
183      if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -3 ) m3 = true;      if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -3 ) m3 = true;
184    };    };
185      if ( !withtrk ) m3 = true;
186    //    //
187    if ( debug ) printf(" Fill estrip matrix needed to calculate variables \n");    if ( debug ) printf(" Fill estrip matrix needed to calculate variables \n");
188    //    //
# Line 165  void CaloPreSampler::Process(){ Line 197  void CaloPreSampler::Process(){
197      //      //
198      mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip);      mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip);
199      //      //
200        // Mask x or y view if nox and/or noy are true (default false)
201        //
202        if ( nox && view == 0 ) mip = 0.;
203        if ( noy && view == 1 ) mip = 0.;
204        //
205      // 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
206      //                 included so plane < (22 - 2)      //                 included so plane < (22 - 2)
207      //      //
# Line 172  void CaloPreSampler::Process(){ Line 209  void CaloPreSampler::Process(){
209        if ( plane < (22 - N) ){        if ( plane < (22 - N) ){
210          //          //
211          if ( emulate18 && plane == (18 - N) ) mip = 0.;          if ( emulate18 && plane == (18 - N) ) mip = 0.;
212            if ( plane >= NC ) mip = 0.;
213          event->clevel1->estrip[strip][plane][view] = mip;          event->clevel1->estrip[strip][plane][view] = mip;
214          //          //
215        };        };
# Line 183  void CaloPreSampler::Process(){ Line 221  void CaloPreSampler::Process(){
221        if ( plane >= N ){        if ( plane >= N ){
222          //          //
223          if ( emulate18 && plane == (18 + N) ) mip = 0.;          if ( emulate18 && plane == (18 + N) ) mip = 0.;
224            if ( (plane-N) >= NC ) mip = 0.;
225          event->clevel1->estrip[strip][(plane-N)][view] = mip;          event->clevel1->estrip[strip][(plane-N)][view] = mip;
226          //          //
227        };        };
# Line 226  void CaloPreSampler::Process(){ Line 265  void CaloPreSampler::Process(){
265    //    //
266    // use only N W planes    // use only N W planes
267    //    //
268    event->clevel1->npla = 22-N;    //  event->clevel1->npla = 22-N;
269      event->clevel1->npla = NC;
270    //    //
271    S3 = 0;    S3 = 0;
272    S2 = 0;    S2 = 0;
# Line 246  void CaloPreSampler::Process(){ Line 286  void CaloPreSampler::Process(){
286    //    //
287    event->clevel1->good2 = 1;    event->clevel1->good2 = 1;
288    //    //
289      // copy variables calculated during calibration process which is skipped here...
290      //
291      event->clevel2->good = L2->GetCaloLevel2()->good;
292      memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr));
293      memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr));
294      memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc));
295      event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger;
296      //
297    // Calculate variables common to all tracks (qtot, nstrip, etc.)    // Calculate variables common to all tracks (qtot, nstrip, etc.)
298    //    //
299    if ( debug ) printf("1 Call GetCommonVar() \n");    if ( debug ) printf("1 Call GetCommonVar() \n");
# Line 451  void CaloPreSampler::Process(){ Line 499  void CaloPreSampler::Process(){
499    if ( debug ) this->Print();    if ( debug ) this->Print();
500    if ( debug ) printf(" exit \n");    if ( debug ) printf(" exit \n");
501    //    //
502  };  }

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

  ViewVC Help
Powered by ViewVC 1.1.23