| 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; |
| 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 |
// |
// |
| 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 |
// |
// |
| 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(){ |
| 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(); |
| 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 |
// |
// |
| 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 |
// |
// |
| 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 |
}; |
}; |
| 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 |
}; |
}; |
| 285 |
// |
// |
| 286 |
event->clevel1->good2 = 1; |
event->clevel1->good2 = 1; |
| 287 |
// |
// |
| 288 |
|
// copy variables calculated during calibration process which is skipped here... |
| 289 |
|
// |
| 290 |
|
event->clevel2->good = L2->GetCaloLevel2()->good; |
| 291 |
|
memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr)); |
| 292 |
|
memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr)); |
| 293 |
|
memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc)); |
| 294 |
|
event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger; |
| 295 |
|
// |
| 296 |
// Calculate variables common to all tracks (qtot, nstrip, etc.) |
// Calculate variables common to all tracks (qtot, nstrip, etc.) |
| 297 |
// |
// |
| 298 |
if ( debug ) printf("1 Call GetCommonVar() \n"); |
if ( debug ) printf("1 Call GetCommonVar() \n"); |
| 498 |
if ( debug ) this->Print(); |
if ( debug ) this->Print(); |
| 499 |
if ( debug ) printf(" exit \n"); |
if ( debug ) printf(" exit \n"); |
| 500 |
// |
// |
| 501 |
}; |
} |