diff --git a/examples/PARAM/hcana.param b/examples/PARAM/hcana.param index d7f6f97b403c0daeace562384cbacb2285482767..61d60c67416cd2b92a6e69416e20b1281f30689b 100644 --- a/examples/PARAM/hcana.param +++ b/examples/PARAM/hcana.param @@ -14,3 +14,4 @@ hdc_plane_names = "1x1 1y1 1u1 1v1 1y2 1x2 2x1 2y1 2u1 2v1 2y2 2x2" hcal_layer_names = "1pr 2ta 3ta 4ta" +hhodo_plane_names = "1x 1y 2x 2y" diff --git a/examples/PARAM/hhodo.param b/examples/PARAM/hhodo.param index 8a4ba606916588424553151b44d4ccb199bea081..4b7fcf89a862e88c022473c458f697227bee964c 100644 --- a/examples/PARAM/hhodo.param +++ b/examples/PARAM/hhodo.param @@ -11,7 +11,7 @@ ; new variable for picking good hits for tof fitting ; this should not be set tight until you are ready to fit ; tof and you figured out good values -htof_tolerance = 50.0 + htof_tolerance = 3.0 ; ; hms_tof_params ; hnum_scin_counters, hhodo_zpos, hhodo_center_coord, hhodo_width @@ -127,38 +127,38 @@ htof_tolerance = 50.0 ; csa 9/8/98 -- I had to hand-twaddle a few of the values ; based on (relative) offsets of older hhodo.param -hhodo_pos_time_offset = 5.5391, 0.0000, -6.8586, 5.1830 - -1.2985, -0.2551, 0.3953, 8.9369 - 5.0531, 1.4333, -6.5520, 8.0628 - 5.5481, -0.3965, -3.6470, 12.8933 - 1.2416, -7.0707, 9.6246, 10.0208 - 1.9282, -0.9275, -4.1448, 8.2112 - 6.4910, -1.5780, 1.8980, 9.6928 - 4.4770, 1.7009, -3.8385, 4.7545 - 2.7533, -2.7182, -5.8864, 6.3882 - 4.3398, 6.1158, -0.3572, -0.4308 - 6.0782, 0.0000, -7.5343, 0.0000 - 5.4665, 0.0000, 0.2169, 0.0000 - 4.1334, 0.0000, 1.3767, 0.0000 - 1.6088, 0.0000, 2.5930, 0.0000 - 3.9776, 0.0000, -5.0340, 0.0000 - 1.6534, 0.0000, 1.5043, 0.0000 -hhodo_neg_time_offset = -2.5728, 0.0000, 2.8982, 10.8670 - -1.9187, -2.6479, 10.6272, 13.8790 - -4.1126, -4.5084, 3.9705, 15.5799 - 0.7699, -2.3908, 11.7183, 15.1612 - -1.2568, -5.0343, 2.9473, 10.6625 - -2.8197, 0.7670, 10.3919, 7.8739 - 1.2798, -3.9185, 4.3248, 11.3533 - -4.8009, -0.2453, 9.2837, 11.6355 - -6.3004, -5.7362, 0.8352, 14.9451 - 1.8476, 6.1209, 11.9751, 15.7375 - 0.3913, 0.0000, 8.9105, 0.0000 - -1.0702, 0.0000, 9.8926, 0.0000 - -2.3617, 0.0000, 5.7061, 0.0000 - -5.2931, 0.0000, 10.7318, 0.0000 - 0.0632, 0.0000, 6.6962, 0.0000 - 6.7208, 0.0000, 13.4108, 0.0000 +hhodo_pos_time_offset = 6.5821, 0.0000, -6.9727, 4.4189 + -1.1011, 0.1270, 0.1930, 8.2907 + 5.5928, 1.2312, -7.0087, 8.3756 + 5.3494, -0.2264, -3.9023, 13.4700 + 1.6938, -7.1708, 9.2976, 9.9767 + 1.7531, -0.9044, -4.6540, 7.8608 + 6.9700, -1.5083, 1.7866, 8.6117 + 3.3819, 1.8281, -4.2414, 4.3756 + 3.4984, -2.5534, -6.0882, 5.4043 + 4.5793, 6.1158, -0.5954, -1.3631 + 6.8272, 0.0000, -7.6493, 32.1266 + 5.4571, 2.0212, 0.2085, 0.0000 + 5.0147, 2.0219, 1.1072, 32.0001 + 1.4959, 0.0000, 2.4523, 0.0000 + 6.2602, 0.0000, -5.1102, -1.9990 + 1.6534, 0.0000, 1.2513, 0.0000 +hhodo_neg_time_offset = -2.4664, 0.0000, 4.1095, 11.9016 + -2.0589, -2.5527, 10.4536, 13.4114 + -4.2564, -3.8944, 3.8712, 15.4475 + 0.3935, -2.2300, 11.5590, 14.8406 + -1.7111, -4.8155, 2.8606, 10.2379 + -3.0792, 0.6972, 10.1887, 7.8083 + 1.0046, -3.6839, 4.2680, 10.9969 + -5.2801, 0.9309, 9.1779, 11.4677 + -6.4931, -5.5225, 0.7246, 14.8212 + 1.6218, 6.1209, 11.8919, 15.5699 + 0.0703, -1.9990, 8.8625, 2.0216 + -1.3146, 0.0000, 9.8650, 0.0000 + -2.9002, 0.0000, 5.6735, 0.0000 + -5.6444, 0.0000, 10.7529, 0.0000 + 0.5662, 0.0000, 6.6559, 2.0115 + 6.7208, 0.0000, 13.4179, 36.7325 ; hhodo_pos_ped_limit = 1000,1000,1000,1000,1000,1000,1000,1000 1000,1000,1000,1000,1000,1000,1000,1000 @@ -178,11 +178,9 @@ hhodo_neg_ped_limit = 1000,1000,1000,1000,1000,1000,1000,1000 1000,1000,1000,1000,1000,1000,1000,1000 1000,1000,1000,1000,1000,1000,1000,1000 - ; use htofusinginvadc=1 if want invadc_offset ; invadc_linear, and invadc_adc to be used htofusinginvadc=1 - hhodo_pos_invadc_offset = 0.00, 0.00, -7.49, 0.00 0.00, -3.93, -1.33, 6.35 -0.47, -1.79, -7.92, 6.66 @@ -251,6 +249,7 @@ hhodo_neg_invadc_linear = 50.00, 50.00, 11.14, 50.00 26.89, 50.00, 11.54, 50.00 50.00, 50.00, 10.51, 50.00 + hhodo_pos_invadc_adc= 0.00, 0.00, 24.53, 0.00 0.00, 85.08, 40.16, 46.66 104.72, 90.39, 48.39, 40.45 @@ -284,48 +283,3 @@ hhodo_neg_invadc_adc= 0.00, 0.00, 33.27, 0.00 78.19, 0.00, 51.72, 0.00 75.03, 0.00, 49.34, 0.00 0.00, 0.00, 53.40, 0.00 - -hhodo_pos_sigma = 100.00, 100.00, 0.92, 100.00 - 100.00, 0.55, 0.85, 0.80 - 0.79, 0.58, 0.80, 0.75 - 0.68, 0.58, 0.65, 0.79 - 0.73, 0.58, 0.66, 0.79 - 0.59, 0.58, 0.65, 0.74 - 0.59, 0.58, 0.53, 0.76 - 0.61, 0.57, 0.67, 0.80 - 0.57, 0.59, 0.64, 0.81 - 0.61, 100.00, 0.64, 0.76 - 0.67, 100.00, 0.67, 100.00 - 0.52, 100.00, 0.61, 100.00 - 0.56, 100.00, 0.62, 100.00 - 0.61, 100.00, 0.71, 100.00 - 0.70, 100.00, 0.74, 100.00 - 100.00, 100.00, 0.66, 100.00 - -hhodo_neg_sigma = 100.00, 100.00, 0.92, 100.00 - 100.00, 0.58, 0.82, 0.80 - 0.74, 0.57, 0.81, 0.81 - 0.68, 0.58, 0.72, 0.81 - 100.00, 0.56, 0.68, 0.88 - 0.61, 0.54, 0.61, 0.76 - 0.53, 0.55, 0.53, 0.73 - 0.58, 0.55, 0.65, 0.80 - 0.61, 0.56, 0.71, 0.87 - 0.59, 100.00, 0.69, 0.88 - 100.00, 100.00, 0.65, 100.00 - 0.57, 100.00, 0.62, 100.00 - 0.58, 100.00, 0.57, 100.00 - 0.59, 100.00, 0.64, 100.00 - 0.57, 100.00, 0.84, 100.00 - 100.00, 100.00, 0.73, 100.00 - - - - - - - - - - - diff --git a/examples/hodtest.C b/examples/hodtest.C index 0a7370289f9f293c9faa1c76b3d9a7bb7ac8a568..b92846d97e26933fda03fd850882f1a6bf5c9d6c 100644 --- a/examples/hodtest.C +++ b/examples/hodtest.C @@ -63,7 +63,7 @@ // Eventually need to learn to skip over, or properly analyze // the pedestal events - run->SetEventRange(1,1000000);// Physics Event number, does not + run->SetEventRange(1,2000);// Physics Event number, does not // include scaler or control events // Define the analysis parameters diff --git a/examples/hodtest_cuts.def b/examples/hodtest_cuts.def index be6d4297d79edd4e786eed2d543a2f3c064a2342..6ccbe52ceb55b33618ab5f59c576546ffe17aa64 100644 --- a/examples/hodtest_cuts.def +++ b/examples/hodtest_cuts.def @@ -9,3 +9,6 @@ RawDecode_master 1 Block: Decode Decode_master !Pedestal_event +Block: CoarseReconstruct +RawCoarseReconstruct !Pedestal_event + diff --git a/examples/output.def b/examples/output.def index 0e282d441984a9b4f648e231783988f941afd4cc..b79e773e4320d040c47cc6a901c1ad05403a26b1 100644 --- a/examples/output.def +++ b/examples/output.def @@ -124,6 +124,7 @@ TH1F hcaladc_B13n 'HMS Cal ADC B13n - PED' H.cal.2ta.aneg_p[12] 150 50 500 # Can we use variables for the constants. In CTP we used hdc_nwire(i) # +<<<<<<< Updated upstream TH1F hdc1x1_wm 'HDC 1X1 Wiremap' H.dc.1x1.tdchits 113 0.5 113.5 TH1F hdc1y1_wm 'HDC 1Y1 Wiremap' H.dc.1y1.tdchits 52 0.5 52.5 TH1F hdc1u1_wm 'HDC 1U1 Wiremap' H.dc.1u1.tdchits 107 0.5 107.5 @@ -164,3 +165,24 @@ TH1F hdc2v1_dd 'HDC 2V1 Drift Distance' H.dc.2v1.dist 300 -0.1 0.6 TH1F hdc2y2_dd 'HDC 2Y2 Drift Distance' H.dc.2y2.dist 300 -0.1 0.6 TH1F hdc2x2_dd 'HDC 2X2 Drift Distance' H.dc.2x2.dist 300 -0.1 0.6 +======= +TH1F hdc1x1_wm 'HDC 1X1 Wiremap' H.dc.1.tdchits 113 0.5 113.5 +TH1F hdc1y1_wm 'HDC 1Y1 Wiremap' H.dc.2.tdchits 52 0.5 52.5 +TH1F hdc1u1_wm 'HDC 1U1 Wiremap' H.dc.3.tdchits 107 0.5 107.5 +TH1F hdc1v1_wm 'HDC 1V1 Wiremap' H.dc.4.tdchits 107 0.5 107.5 +TH1F hdc1y2_wm 'HDC 1Y2 Wiremap' H.dc.5.tdchits 52 0.5 52.5 +TH1F hdc1x2_wm 'HDC 1X2 Wiremap' H.dc.6.tdchits 113 0.5 113.5 +TH1F hdc2x1_wm 'HDC 2X1 Wiremap' H.dc.7.tdchits 113 0.5 113.5 +TH1F hdc2y1_wm 'HDC 2Y1 Wiremap' H.dc.8.tdchits 52 0.5 52.5 +TH1F hdc2u1_wm 'HDC 2U1 Wiremap' H.dc.9.tdchits 107 0.5 107.5 +TH1F hdc2v1_wm 'HDC 2V1 Wiremap' H.dc.10.tdchits 107 0.5 107.5 +TH1F hdc2y2_wm 'HDC 2Y2 Wiremap' H.dc.11.tdchits 52 0.5 52.5 +TH1F hdc2x2_wm 'HDC 2X2 Wiremap' H.dc.12.tdchits 113 0.5 113.5 + +# Focal Plane times +TH1F hs1xfptime 'HODO s1x fptime' H.hod.1x.fptime 80 0 80 H.hod.hgoodstarttime +TH1F hs1yfptime 'HODO s1y fptime' H.hod.1y.fptime 80 0 80 H.hod.hgoodstarttime +TH1F hs2xfptime 'HODO s2x fptime' H.hod.2x.fptime 80 0 80 H.hod.hgoodstarttime +TH1F hs2yfptime 'HODO s2y fptime' H.hod.2y.fptime 80 0 80 H.hod.hgoodstarttime +TH1F starttime 'HODO start time' H.hod.starttime 80 0 80 H.hod.hgoodstarttime +>>>>>>> Stashed changes diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index 4d09ccf2560968b566b79fcccd8ae438bc95ae92..01dda244384d4a6589d77c9ee2cae7e00cf201f1 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -73,15 +73,29 @@ void THcHodoscope::Setup(const char* name, const char* description) prefix[0]=tolower(GetApparatus()->GetName()[0]); prefix[1]='\0'; + string planenamelist; DBRequest listextra[]={ {"hodo_num_planes", &fNPlanes, kInt}, + {"hodo_plane_names",&planenamelist, kString}, {0} }; fNPlanes = 4; // Default if not defined gHcParms->LoadParmValues((DBRequest*)&listextra,prefix); - // Plane names + cout << "Plane Name List : " << planenamelist << endl; + + vector<string> plane_names = vsplit(planenamelist); + // Plane names + if(plane_names.size() != (UInt_t) fNPlanes) { + cout << "ERROR: Number of planes " << fNPlanes << " doesn't agree with number of plane names " << plane_names.size() << endl; + // Should quit. Is there an official way to quit? + } fPlaneNames = new char* [fNPlanes]; + for(Int_t i=0;i<fNPlanes;i++) { + fPlaneNames[i] = new char[plane_names[i].length()]; + strcpy(fPlaneNames[i], plane_names[i].c_str()); + } + /* fPlaneNames = new char* [fNPlanes]; for(Int_t i=0;i<fNPlanes;i++) {fPlaneNames[i] = new char[3];} // Should get the plane names from parameters. // could try this: grep _zpos PARAM/hhodo.pos | sed 's/\_/\ /g' | awk '{print $2}' @@ -89,16 +103,15 @@ void THcHodoscope::Setup(const char* name, const char* description) strcpy(fPlaneNames[1],"1y"); strcpy(fPlaneNames[2],"2x"); strcpy(fPlaneNames[3],"2y"); - + */ // Probably shouldn't assume that description is defined - char* desc = new char[strlen(description)+50]; + char* desc = new char[strlen(description)+100]; fPlanes = new THcScintillatorPlane* [fNPlanes]; for(Int_t i=0;i < fNPlanes;i++) { strcpy(desc, description); strcat(desc, " Plane "); strcat(desc, fPlaneNames[i]); - fPlanes[i] = new THcScintillatorPlane(fPlaneNames[i], desc, i+1,fNPlanes, this); - //fPlanes[i] = new THcScintillatorPlane(fPlaneNames[i], desc, i+1, this); + fPlanes[i] = new THcScintillatorPlane(fPlaneNames[i], desc, i+1,this); // Number planes starting from zero!! cout << "Created Scintillator Plane " << fPlaneNames[i] << ", " << desc << endl; } } @@ -455,7 +468,9 @@ Int_t THcHodoscope::DefineVariables( EMode mode ) //... // hnegtdc4 HMS s2y- TDC hits - // RVarDef vars[] = { + RVarDef vars[] = { + {"starttime","Hodoscope Start Time","fStartTime"}, + {"hgoodstarttime","Hodoscope Good Start Time","fGoodStartTime"}, // { "nlthit", "Number of Left paddles TDC times", "fLTNhit" }, // { "nrthit", "Number of Right paddles TDC times", "fRTNhit" }, // { "nlahit", "Number of Left paddles ADCs amps", "fLANhit" }, @@ -484,10 +499,10 @@ Int_t THcHodoscope::DefineVariables( EMode mode ) // { "trpath", "TRCS pathlen of track to det plane","fTrackProj.THaTrackProj.fPathl" }, // { "trdx", "track deviation in x-position (m)", "fTrackProj.THaTrackProj.fdX" }, // { "trpad", "paddle-hit associated with track", "fTrackProj.THaTrackProj.fChannel" }, - // { 0 } - // }; - // return DefineVarsFromList( vars, mode ); - return kOK; + { 0 } + }; + return DefineVarsFromList( vars, mode ); + // return kOK; } //_____________________________________________________________________________ @@ -594,6 +609,7 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) Int_t nexthit = 0; Int_t nfptimes=0; + fStartTime=0; for(Int_t ip=0;ip<fNPlanes;ip++) { // nexthit = fPlanes[ip]->ProcessHits(fRawHitList, nexthit); // GN: select only events that have reasonable TDC values to start with @@ -601,9 +617,8 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) nexthit = fPlanes[ip]->ProcessHits(fRawHitList,nexthit); if (fPlanes[ip]->GetNScinHits()>0) { fPlanes[ip]->PulseHeightCorrection(); - ///cout <<"Plane "<<ip<<" number of fpTimes = "<<fPlanes[ip]->GetFpTimeHits()<<endl; - for (Int_t ifptimes=0;ifptimes<fPlanes[ip]->GetFpTimeHits();ifptimes++) { - fStartTime=fStartTime+fPlanes[ip]->GetFpTime(ifptimes); + if (TMath::Abs(fPlanes[ip]->GetFpTime()-fStartTimeCenter)<=fStartTimeSlop) { + fStartTime=fStartTime+fPlanes[ip]->GetFpTime(); nfptimes++; } } diff --git a/src/THcScintillatorPlane.cxx b/src/THcScintillatorPlane.cxx index f1ccda77f1890d99e1453e9b6928a2275943c675..0d2c7c230c2b3aac5d2541fd2dc9e9995923855c 100644 --- a/src/THcScintillatorPlane.cxx +++ b/src/THcScintillatorPlane.cxx @@ -41,8 +41,7 @@ THcScintillatorPlane::THcScintillatorPlane( const char* name, fNScinHits = 0; // fMaxHits=53; - fpTimeHits=0; - fpTime = new Double_t [fMaxHits]; + fpTime = -1.e5; } //______________________________________________________________________________ THcScintillatorPlane::THcScintillatorPlane( const char* name, @@ -62,8 +61,7 @@ THcScintillatorPlane::THcScintillatorPlane( const char* name, fNScinHits = 0; // fMaxHits=53; - fpTimeHits=0; - fpTime = new Double_t [fMaxHits]; + fpTime = -1.e5; } @@ -75,7 +73,6 @@ THcScintillatorPlane::~THcScintillatorPlane() delete fNegTDCHits; delete fPosADCHits; delete fNegADCHits; - delete fpTime; } //______________________________________________________________________________ @@ -217,6 +214,8 @@ Int_t THcScintillatorPlane::DefineVariables( EMode mode ) "fPosADCHits.THcSignalHit.GetPaddleNumber()"}, {"negadchits", "List of Negative ADC hits", "fNegADCHits.THcSignalHit.GetPaddleNumber()"}, + {"fptime", "Time at focal plane", + "GetFpTime()"}, { 0 } }; @@ -280,7 +279,6 @@ Int_t THcScintillatorPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) fNegTDCHits->Clear(); fPosADCHits->Clear(); fNegADCHits->Clear(); - Int_t nrawhits = rawhits->GetLast()+1; // cout << "THcScintillatorPlane::ProcessHits " << fPlaneNum << " " << nexthit << "/" << nrawhits << endl; mintdc=((THcHodoscope *)GetParent())->GetTdcMin(); @@ -295,30 +293,38 @@ Int_t THcScintillatorPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) // check TDC values if (((hit->fTDC_pos >= mintdc) && (hit->fTDC_pos <= maxtdc)) || ((hit->fTDC_neg >= mintdc) && (hit->fTDC_neg <= maxtdc))) { - + // GN: careful here: hit->fCounter will return elements starting from 1 + // if one wants to count from zero (as one should!) we need to take care of this straight away!! + // + Int_t element=hit->fCounter-1; + //********** + /// cout <<"hcana plane = "<<fPlaneNum<<" counter = "<<element<<endl; + //********** //TDC positive hit THcSignalHit *sighit = (THcSignalHit*) fPosTDCHits->ConstructedAt(nPosTDCHits++); - sighit->Set(hit->fCounter, hit->fTDC_pos); + sighit->Set(element, hit->fTDC_pos); // TDC negative hit THcSignalHit *sighit2 = (THcSignalHit*) fNegTDCHits->ConstructedAt(nNegTDCHits++); - sighit2->Set(hit->fCounter, hit->fTDC_neg); + sighit2->Set(element, hit->fTDC_neg); // ADC positive hit /// if(hit->fADC_pos > 0) { - THcSignalHit *sighit3 = (THcSignalHit*) fPosADCHits->ConstructedAt(nPosADCHits++); - sighit3->Set(hit->fCounter, hit->fADC_pos-fPosPed[ihit]); + THcSignalHit *sighit3 = (THcSignalHit*) fPosADCHits->ConstructedAt(nPosADCHits++); + sighit3->Set(element, hit->fADC_pos-fPosPed[element]); + ///cout <<"hcana raw/ped = "<<hit->fADC_pos<<" "<<fPosPed[element]<<endl; ///} else { /// cout<<"Skipping ADC_pos "<<hit->fADC_pos<<endl; /// } // ADC negative hit /// if(hit->fADC_neg > 0) { // cout <<"adc neg hit!!\n"; - THcSignalHit *sighit4 = (THcSignalHit*) fNegADCHits->ConstructedAt(nNegADCHits++); - sighit4->Set(hit->fCounter, hit->fADC_neg-fNegPed[ihit]); + THcSignalHit *sighit4 = (THcSignalHit*) fNegADCHits->ConstructedAt(nNegADCHits++); + sighit4->Set(element, hit->fADC_neg-fNegPed[element]); + + fNScinHits++; ///} else { ///cout<<"Skipping ADC_neg "<<hit->fADC_neg<<endl; ///} // cout <<"test "<<fNHits<<endl; - fNScinHits=fNScinHits++; } else { //cout <<"pos TDC "<<hit->fTDC_pos<<" "<<mintdc<<" "<<maxtdc<<endl; @@ -364,7 +370,7 @@ Int_t THcScintillatorPlane::PulseHeightCorrection() for (i=0;i<200;i++) { timehist[i]=0; } - for (i=0;i<53;i++) { + for (i=0;i<fMaxHits;i++) { keep_pos[i]=kFALSE; keep_neg[i]=kFALSE; two_good_times[i]=kFALSE; @@ -376,8 +382,8 @@ Int_t THcScintillatorPlane::PulseHeightCorrection() toftolerance=((THcHodoscope *)GetParent())->GetTofTolerance(); // hbeta_pcent=(TH((THcHodoscope *)GetParent())->GetParent() // Horrible hack until I find out where to get the central beta from momentum!! GN - hbeta_pcent=0.99776; - + hbeta_pcent=1.0; + fpTime=-1e5; for (i=0;i<fNScinHits;i++) { if ((((THcSignalHit*) fPosTDCHits->At(i))->GetData()>=mintdc) && (((THcSignalHit*) fPosTDCHits->At(i))->GetData()<=maxtdc) && @@ -390,6 +396,7 @@ Int_t THcScintillatorPlane::PulseHeightCorrection() postime[i]=postime[i]-((THcHodoscope *)GetParent())->GetHodoPosPhcCoeff(index)* TMath::Sqrt(TMath::Max(0.,(pos_ph[i]/((THcHodoscope *)GetParent())->GetHodoPosMinPh(index)-1))); postime[i]=postime[i]-((THcHodoscope *)GetParent())->GetHodoPosTimeOffset(index); + neg_ph[i]=((THcSignalHit*) fNegADCHits->At(i))->GetData(); negtime[i]=((THcSignalHit*) fNegTDCHits->At(i))->GetData()*tdctotime; j=((THcSignalHit*)fNegTDCHits->At(i))->GetPaddleNumber(); @@ -397,6 +404,16 @@ Int_t THcScintillatorPlane::PulseHeightCorrection() negtime[i]=negtime[i]-((THcHodoscope *)GetParent())->GetHodoNegPhcCoeff(index)* TMath::Sqrt(TMath::Max(0.,(neg_ph[i]/((THcHodoscope *)GetParent())->GetHodoNegMinPh(index)-1))); negtime[i]=negtime[i]-((THcHodoscope *)GetParent())->GetHodoNegTimeOffset(index); + + // *************** + /// cout <<"hcana i = "<<i<<endl; + /// cout <<"hcana tdc_pos = "<<((THcSignalHit*) fPosTDCHits->At(i))->GetData()<<endl; + ///cout <<"hcana pos_ph = "<<pos_ph[i]<<endl; + // cout <<"hcana pos_phc_coeff = "<<((THcHodoscope *)GetParent())->GetHodoPosPhcCoeff(index)<<endl; + // cout <<"hcana postime = "<<postime[i]<<endl; + //cout <<"hcana negtime = "<<negtime[i]<<endl; + //************* + // Find hit position. If postime larger, then hit was nearer negative side. dist_from_center=0.5*(negtime[i]-postime[i])*((THcHodoscope *)GetParent())->GetHodoVelLight(index); scint_center=0.5*(fPosLeft+fPosRight); @@ -405,6 +422,7 @@ Int_t THcScintillatorPlane::PulseHeightCorrection() hit_position=TMath::Max(hit_position,fPosRight); postime[i]=postime[i]-(fPosLeft-hit_position)/((THcHodoscope *)GetParent())->GetHodoVelLight(index); negtime[i]=negtime[i]-(hit_position-fPosRight)/((THcHodoscope *)GetParent())->GetHodoVelLight(index); + time_pos[i]=postime[i]-(fZpos+(j%2)*fDzpos)/(29.979*hbeta_pcent); time_neg[i]=negtime[i]-(fZpos+(j%2)*fDzpos)/(29.979*hbeta_pcent); nfound++; @@ -421,7 +439,7 @@ Int_t THcScintillatorPlane::PulseHeightCorrection() } } // Find the bin with most hits - jmax=-1; + jmax=0; maxhit=0; for (i=0;i<200;i++) { if (timehist[i]>maxhit) { @@ -451,7 +469,6 @@ Int_t THcScintillatorPlane::PulseHeightCorrection() two_good_times[i]=kTRUE; } } // end of loop that finds tube setting time - fpTimeHits=0; for (i=0;i<fNScinHits;i++) { if (two_good_times[i]) { // both tubes fired // correct time for everything except veloc. correction in order @@ -480,13 +497,15 @@ Int_t THcScintillatorPlane::PulseHeightCorrection() postime[i]=postime[i]-(fPosLeft-hit_position)/((THcHodoscope *)GetParent())->GetHodoVelLight(index); negtime[i]=negtime[i]-(hit_position-fPosRight)/((THcHodoscope *)GetParent())->GetHodoVelLight(index); scin_corrected_time[i]=0.5*(postime[i]+negtime[i]); - fpTime[i]=scin_corrected_time[i]-(fZpos+(j%2)*fDzpos)/(29.979*hbeta_pcent); - /// cout <<"fptime ["<<i<<"]= "<<fpTime[i]<<endl; - fpTimeHits++; + fpTime=scin_corrected_time[i]-(fZpos+(j%2)*fDzpos)/(29.979*hbeta_pcent); + + //cout <<"hcana corr_time = "<<scin_corrected_time[i]<<endl; + //cout<<"hcana hbeta_pcent = "<<hbeta_pcent<<endl; + //cout<<"hcana zpos = "<<(fZpos+(j%2)*fDzpos)<<endl; + //cout <<"hcana fptime = "<<fpTime<<endl; } else { // only one tube fired scin_corrected_time[i]=0.0; // not a very good "flag" but there is the logical two_good_hits... - fpTime[i]=0.0; // NOTE: we're not incrementing fpTimeHits. In principle these two lines might be deleted } } // Start time calculation, assume xp=yp=0 radians. project all @@ -552,7 +571,7 @@ void THcScintillatorPlane::CalculatePedestals( ) fNegPed[i] = ((Double_t) fNegPedSum[i]) / TMath::Max(1, fNegPedCount[i]); fNegThresh[i] = fNegPed[i] + 15; - // cout << i+1 << " " << fPosPed[i] << " " << fNegPed[i] << endl; + // cout <<"Pedestals "<< i+1 << " " << fPosPed[i] << " " << fNegPed[i] << endl; } // cout << " " << endl; diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index f47b1ebdd721d7c954a84663b42abb492e349230..0a2239a8b83fbd03720c6ce7395e7a73db225b13 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -53,8 +53,7 @@ class THcScintillatorPlane : public THaSubDetector { Double_t GetPosRight(); Double_t GetPosOffset(); Double_t GetPosCenter(Int_t PaddleNo); // here we're counting from zero! - Double_t GetFpTime(Int_t index) { return fpTime[index];}; - Int_t GetFpTimeHits() { return fpTimeHits;}; + Double_t GetFpTime() { return fpTime;}; TClonesArray* fParentHitList; @@ -103,8 +102,8 @@ class THcScintillatorPlane : public THaSubDetector { Double_t *fNegThresh; // - Int_t fpTimeHits; // number of entries in *fpTime - Double_t *fpTime; // array with fpTimes for this scintillator plane + Double_t fpTime; // the original code only has one fpTime per plane! + virtual Int_t ReadDatabase( const TDatime& date ); virtual Int_t DefineVariables( EMode mode = kDefine ); diff --git a/src/THcSignalHit.h b/src/THcSignalHit.h index da9d27bbacafefd96e8c1d401a2fd860adcfcb2e..6af80a6e68a203261d306336022d015a237a71cf 100644 --- a/src/THcSignalHit.h +++ b/src/THcSignalHit.h @@ -22,6 +22,8 @@ class THcSignalHit : public TObject { virtual void Set(Int_t paddle, Int_t data) { fPaddleNumber=paddle; fData=data; } + virtual void Set(Int_t paddle, Double_t data) + { fPaddleNumber=paddle; fData=data; } private: Int_t fPaddleNumber;