20 for (
unsigned int i=0;i<cdcwires.size();i++){
21 for (
unsigned int j=0;j<cdcwires[i].size();j++){
22 delete cdcwires[i][j];
33 MATCH_TRUTH_HITS=
false;
35 gPARMS->SetDefaultParameter(
"CDC:MATCH_TRUTH_HITS",MATCH_TRUTH_HITS,
"Match truth hits to CDC hits (DEF=false)");
54 for (
unsigned int i=0;i<cdcwires.size();i++){
55 Nstraws[i]=cdcwires[i].size();
59 JCalibration *jcalib = dapp->GetJCalibration((loop->GetJEvent()).GetRunNumber());
60 map<string, double> cdc_drift_parms;
61 jcalib->Get(
"CDC/cdc_drift_parms", cdc_drift_parms);
62 CDC_DRIFT_BSCALE_PAR1 = cdc_drift_parms[
"bscale_par1"];
63 CDC_DRIFT_BSCALE_PAR2 = cdc_drift_parms[
"bscale_par2"];
65 typedef map<string,double>::iterator iter_double;
66 vector< map<string, double> > tvals;
67 if (jcalib->Get(
"CDC/cdc_drift_table", tvals)==
false){
68 for(
unsigned int i=0; i<tvals.size(); i++){
69 map<string, double> &row = tvals[i];
70 iter_double iter = row.find(
"t");
76 jerr <<
" No values found for \"CDC/cdc_drift_table\"!" <<endl;
78 jerr <<
" This probably means you'r using an old calibration DB." << endl;
79 jerr <<
" Check your JANA_CALIB_URL environment variable." << endl;
80 jerr <<
" (This message printed from DCDCTrackHit_factory::brun())" << endl;
91 for (
unsigned int i=0;i<cdcwires.size();i++){
92 for (
unsigned int j=0;j<cdcwires[i].size();j++){
93 delete cdcwires[i][j];
108 vector<const DCDCHit*> cdchits;
110 if (cdchits.size()==0)
return NOERROR;
117 vector<const DMCTrackHit*> mctrackhits;
118 if (MATCH_TRUTH_HITS)loop->Get(mctrackhits);
120 for(
unsigned int i=0; i<cdchits.size(); i++){
121 const DCDCHit* cdchit = cdchits[i];
125 cerr<<__FILE__<<
":"<<__LINE__<<
" Ring or straw out of range! ring="
127 <<cdchit->
straw<<
" (should be 1-"<<Nstraws[cdchit->
ring-1]<<
")"<<endl;
134 ||(cdchit->
ring>16&&cdchit->
ring<25))
138 double w_eff=29.5e-9;
140 double electron_charge=1.6022e-4;
141 double dEscale=w_eff/(gas_gain*electron_charge);
142 hit->
dE=cdchit->
q*dEscale;
152 double dtc =(CDC_DRIFT_BSCALE_PAR1 + CDC_DRIFT_BSCALE_PAR2 * B)* hit->
tdrift;
153 double tcorr = hit->
tdrift - dtc;
154 unsigned int index=0;
155 if(tcorr < cdc_drift_table_min){
157 }
else if (tcorr >= cdc_drift_table_max){
163 double frac=(tcorr-cdc_drift_table[
index])/dt;
166 hit->AddAssociatedObject(cdchit);
168 if (MATCH_TRUTH_HITS==
true&&mctrackhits.size()>0){
171 if (cdchit->
t>0) d=0.0279*
sqrt(cdchit->
t);
177 if(mctrackhit)hit->AddAssociatedObject(mctrackhit);
180 _data.push_back(hit);
199 ascnd=(xx[n-1]>=xx[0]);
202 if ( (x>=xx[jm])==ascnd)
207 if (x==xx[0])
return 0;
208 else if (x==xx[n-1])
return n-2;
jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
Invoked via JEventProcessor virtual method.
jerror_t brun(JEventLoop *loop, int32_t runnumber)
static char index(char c)
static const DMCTrackHit * GetMCTrackHit(const DCoordinateSystem *wire, double rdrift, vector< const DMCTrackHit * > &mctrackhits, int trackno_filter=-1)
static void locate(const double *xx, int n, double x, int *j)
bool GetCDCWires(vector< vector< DCDCWire * > > &cdcwires) const
vector< double > cdc_drift_table
DGeometry * GetDGeometry(unsigned int run_number)
unsigned int locate(vector< double > &xx, double x)