| 12 |
*/ |
*/ |
| 13 |
CaloPreSampler::CaloPreSampler(){ |
CaloPreSampler::CaloPreSampler(){ |
| 14 |
Clear(); |
Clear(); |
| 15 |
}; |
} |
| 16 |
|
|
| 17 |
CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){ |
CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){ |
| 18 |
// |
// |
| 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; |
| 39 |
simulation = false; |
simulation = false; |
| 40 |
withtrk = true; |
withtrk = true; |
| 41 |
rigdefault = 50.; |
rigdefault = 50.; |
| 42 |
|
nox = false; |
| 43 |
|
noy = false; |
| 44 |
|
forcecalo = false; |
| 45 |
|
memset(mask,0,2*22*sizeof(Int_t)); |
| 46 |
// |
// |
| 47 |
Clear(); |
Clear(); |
| 48 |
// |
// |
| 69 |
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()); |
| 70 |
trk->LoadField(q4->PATH+q4->NAME); |
trk->LoadField(q4->PATH+q4->NAME); |
| 71 |
// |
// |
| 72 |
}; |
} |
| 73 |
|
|
| 74 |
|
void CaloPreSampler::SetNoWpreSampler(Int_t n){ |
| 75 |
|
if ( NC+n < 23 ){ |
| 76 |
|
N = n; |
| 77 |
|
} else { |
| 78 |
|
printf(" ERROR! Calorimeter is made of 22 W planes\n"); |
| 79 |
|
printf(" you are giving N presampler = %i and N calo = %i \n",n,NC); |
| 80 |
|
printf(" WARNING: using default values NWpre = 4, NWcalo = 18\n"); |
| 81 |
|
NC = 18; |
| 82 |
|
N = 4; |
| 83 |
|
}; |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
void CaloPreSampler::SetNoWcalo(Int_t n){ |
| 87 |
|
if ( N+n < 23 ){ |
| 88 |
|
NC = n; |
| 89 |
|
} else { |
| 90 |
|
printf(" ERROR! Calorimeter is made of 22 W planes\n"); |
| 91 |
|
printf(" you are giving N W presampler = %i and N W calo = %i \n",N,n); |
| 92 |
|
printf(" WARNING: using default values NWpre = 4, NWcalo = 18\n"); |
| 93 |
|
NC = 18; |
| 94 |
|
N = 4; |
| 95 |
|
}; |
| 96 |
|
} |
| 97 |
|
|
| 98 |
void CaloPreSampler::Clear(){ |
void CaloPreSampler::Clear(){ |
| 99 |
// |
// |
| 100 |
pcalo->Clear(); |
pcalo->Clear(); |
| 101 |
// |
// |
| 102 |
}; |
} |
| 103 |
|
|
| 104 |
void CaloPreSampler::Print(){ |
void CaloPreSampler::Print(){ |
| 105 |
// |
// |
| 121 |
}; |
}; |
| 122 |
printf("========================================================================\n"); |
printf("========================================================================\n"); |
| 123 |
// |
// |
| 124 |
}; |
} |
| 125 |
|
|
| 126 |
void CaloPreSampler::Delete(){ |
void CaloPreSampler::Delete(){ |
| 127 |
Clear(); |
Clear(); |
| 128 |
delete pcalo; |
delete pcalo; |
| 129 |
//delete this; |
//delete this; |
| 130 |
}; |
} |
| 131 |
|
|
| 132 |
|
|
| 133 |
void CaloPreSampler::Process(){ |
void CaloPreSampler::Process(){ |
| 199 |
// |
// |
| 200 |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
| 201 |
// |
// |
| 202 |
|
// Mask x or y view if nox and/or noy are true (default false) |
| 203 |
|
// |
| 204 |
|
if ( mask[view][plane] ) mip = 0.; |
| 205 |
|
if ( nox && view == 0 ) mip = 0.; |
| 206 |
|
if ( noy && view == 1 ) mip = 0.; |
| 207 |
|
// |
| 208 |
// 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 |
| 209 |
// included so plane < (22 - 2) |
// included so plane < (22 - 2) |
| 210 |
// |
// |
| 211 |
if ( sel ){ |
if ( sel ){ |
| 212 |
if ( plane < (22 - N) ){ |
if ( plane < (22 - N) ){ |
| 213 |
// |
// |
| 214 |
if ( emulate18 && plane == (18 - N) ) mip = 0.; |
if ( emulate18 && plane == (18 - N) && view == 0 ) mip = 0.; |
| 215 |
|
if ( plane >= NC ) mip = 0.; |
| 216 |
event->clevel1->estrip[strip][plane][view] = mip; |
event->clevel1->estrip[strip][plane][view] = mip; |
| 217 |
// |
// |
| 218 |
}; |
}; |
| 223 |
if ( cont ){ |
if ( cont ){ |
| 224 |
if ( plane >= N ){ |
if ( plane >= N ){ |
| 225 |
// |
// |
| 226 |
if ( emulate18 && plane == (18 + N) ) mip = 0.; |
if ( emulate18 && plane == (18 + N) && view == 0 ) mip = 0.; |
| 227 |
|
if ( (plane-N) >= NC ) mip = 0.; |
| 228 |
event->clevel1->estrip[strip][(plane-N)][view] = mip; |
event->clevel1->estrip[strip][(plane-N)][view] = mip; |
| 229 |
// |
// |
| 230 |
}; |
}; |
| 268 |
// |
// |
| 269 |
// use only N W planes |
// use only N W planes |
| 270 |
// |
// |
| 271 |
event->clevel1->npla = 22-N; |
// event->clevel1->npla = 22-N; |
| 272 |
|
event->clevel1->npla = NC; |
| 273 |
// |
// |
| 274 |
S3 = 0; |
S3 = 0; |
| 275 |
S2 = 0; |
S2 = 0; |
| 360 |
// 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 |
| 361 |
// |
// |
| 362 |
// 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. ){ |
| 363 |
if ( trackanyway && m3 ){ |
if ( (trackanyway && m3) || forcecalo ){ |
| 364 |
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"); |
| 365 |
// |
// |
| 366 |
// Disable "track mode" in the fortran routine |
// Disable "track mode" in the fortran routine |
| 502 |
if ( debug ) this->Print(); |
if ( debug ) this->Print(); |
| 503 |
if ( debug ) printf(" exit \n"); |
if ( debug ) printf(" exit \n"); |
| 504 |
// |
// |
| 505 |
}; |
} |