Hall C ROOT/C++ Analyzer (hcana)
Loading...
Searching...
No Matches
THcShower.cxx
Go to the documentation of this file.
1
8#include "THcShower.h"
10#include "THaEvData.h"
11#include "THaDetMap.h"
12#include "THcDetectorMap.h"
13#include "THcGlobals.h"
14#include "THaCutList.h"
15#include "THcParmList.h"
16#include "VarDef.h"
17#include "VarType.h"
18#include "THaTrack.h"
19#include "TClonesArray.h"
20#include "THaTrackProj.h"
21#include "TMath.h"
22#include "Helper.h"
23#include "Textvars.h" // for Podd::vsplit
24
25#include <cstring>
26#include <cstdio>
27#include <cstdlib>
28#include <iostream>
29#include <numeric>
30#include <cassert>
31
32using namespace std;
33
34//_____________________________________________________________________________
35THcShower::THcShower( const char* name, const char* description,
36 THaApparatus* apparatus ) :
37 THaNonTrackingDetector(name,description,apparatus),
38 fPosAdcTimeWindowMin(0), fNegAdcTimeWindowMin(0),
39 fPosAdcTimeWindowMax(0), fNegAdcTimeWindowMax(0),
40 fPedPosDefault(0),fPedNegDefault(0),
41 fShPosPedLimit(0), fShNegPedLimit(0), fPosGain(0), fNegGain(0),
42 fClusterList(0), fLayerNames(0), fLayerZPos(0), BlockThick(0),
43 fNBlocks(0), fXPos(0), fYPos(0), fZPos(0), fPlanes(0), fArray(0)
44{
45 // Constructor
46 fNLayers = 0; // No layers until we make them
47 fNTotLayers = 0;
48 fHasArray = 0;
49
51}
52
53//_____________________________________________________________________________
56 fPosAdcTimeWindowMin(0), fNegAdcTimeWindowMin(0),
57 fPosAdcTimeWindowMax(0), fNegAdcTimeWindowMax(0),
58 fPedPosDefault(0),fPedNegDefault(0),
59 fShPosPedLimit(0), fShNegPedLimit(0), fPosGain(0), fNegGain(0),
60 fClusterList(0), fLayerNames(0), fLayerZPos(0), BlockThick(0),
61 fNBlocks(0), fXPos(0), fYPos(0), fZPos(0), fPlanes(0), fArray(0)
62{
63 // Constructor
64}
65
66//_____________________________________________________________________________
67void THcShower::Setup(const char* name, const char* description)
68{
69 char prefix[2];
70
71 prefix[0] = tolower(GetApparatus()->GetName()[0]);
72 prefix[1] = '\0';
73
74
75 string layernamelist;
76 fHasArray = 0; // Flag for presence of fly's eye array
77 DBRequest list[]={
78 {"cal_num_layers", &fNLayers, kInt},
79 {"cal_layer_names", &layernamelist, kString},
80 {"cal_array",&fHasArray, kInt,0, 1},
81 {"cal_adcrefcut", &fADC_RefTimeCut, kInt, 0, 1},
82 {0}
83 };
84
86 gHcParms->LoadParmValues((DBRequest*)&list,prefix);
87 fNTotLayers = (fNLayers+(fHasArray!=0?1:0));
88 vector<string> layer_names = Podd::vsplit(layernamelist);
89
90 if(layer_names.size() != fNTotLayers) {
91 cout << "THcShower::Setup ERROR: Number of layers " << fNTotLayers
92 << " doesn't agree with number of layer names "
93 << layer_names.size() << endl;
94 // Should quit. Is there an official way to quit?
95 }
96
97 fLayerNames = new char* [fNTotLayers];
98 for(UInt_t i=0;i<fNTotLayers;i++) {
99 fLayerNames[i] = new char[layer_names[i].length()+1];
100 strcpy(fLayerNames[i], layer_names[i].c_str());
101 }
102
103 char *desc = new char[strlen(description)+100];
105
106 for(UInt_t i=0;i < fNLayers;i++) {
107 strcpy(desc, description);
108 strcat(desc, " Plane ");
109 strcat(desc, fLayerNames[i]);
110
111 fPlanes[i] = new THcShowerPlane(fLayerNames[i], desc, i+1, this);
112
113 }
114 if(fHasArray) {
115 strcpy(desc, description);
116 strcat(desc, " Array ");
117 strcat(desc, fLayerNames[fNTotLayers-1]);
118
120 this);
121 } else {
122 fArray = 0;
123 }
124
125 delete [] desc;
126
127 // cout << "---------------------------------------------------------------\n";
128
129 cout << "From THcShower::Setup: created Shower planes for "
130 << GetApparatus()->GetName() << ": ";
131
132 for(UInt_t i=0;i < fNTotLayers;i++) {
133 cout << fLayerNames[i];
134 i < fNTotLayers-1 ? cout << ", " : cout << ".\n";
135 }
136
137 // if(fHasArray)
138 // cout << fLayerNames[fNTotLayers-1] << " has fly\'s eye configuration\n";
139
140 // cout << "---------------------------------------------------------------\n";
141
142}
143
144
145//_____________________________________________________________________________
147{
148 Setup(GetName(), GetTitle());
149
150 char EngineDID[] = "xCAL";
151 EngineDID[0] = toupper(GetApparatus()->GetName()[0]);
152 if( gHcDetectorMap->FillMap(fDetMap, EngineDID) < 0 ) {
153 static const char* const here = "Init()";
154 Error( Here(here), "Error filling detectormap for %s.", EngineDID );
155 return kInitError;
156 }
157
158 // Should probably put this in ReadDatabase as we will know the
159 // maximum number of hits after setting up the detector map
160
161 InitHitList(fDetMap, "THcRawShowerHit", fDetMap->GetTotNumChan()+1,
162 0, fADC_RefTimeCut);
163
164 EStatus status;
165 if( (status = THaNonTrackingDetector::Init( date )) )
166 return fStatus=status;
167
168 for(UInt_t ip=0;ip<fNLayers;ip++) {
169 if((status = fPlanes[ip]->Init( date ))) {
170 return fStatus=status;
171 }
172 }
173 if(fHasArray) {
174 if((status = fArray->Init( date ))) {
175 return fStatus = status;
176 }
177 }
178
179 if(fHasArray) {
180 // cout << "THcShower::Init: adjustment of fiducial volume limits to the fly's eye part." << endl;
181 // cout << " Old limits:" << endl;
182 // cout << " Xmin = " << fvXmin << " Xmax = " << fvXmax << endl;
183 // cout << " Ymin = " << fvYmin << " Ymax = " << fvYmax << endl;
188 // cout << " New limits:" << endl;
189 // cout << " Xmin = " << fvXmin << " Xmax = " << fvXmax << endl;
190 // cout << " Ymin = " << fvYmin << " Ymax = " << fvYmax << endl;
191 }
192
193 // cout << "---------------------------------------------------------------\n";
194 // cout << "From THcShower::Init: initialized " << GetApparatus()->GetName()
195 // << GetName() << endl;
196 // cout << "---------------------------------------------------------------\n";
197
198 fPresentP = 0;
199 THaVar* vpresent = gHaVars->Find(Form("%s.present",GetApparatus()->GetName()));
200 if(vpresent) {
201 fPresentP = (Bool_t *) vpresent->GetValuePointer();
202 }
203 return fStatus = kOK;
204}
205
206//_____________________________________________________________________________
208{
209 // Read this detector's parameters from the database file 'fi'.
210 // This function is called by THaDetectorBase::Init() once at the
211 // beginning of the analysis.
212 // 'date' contains the date/time of the run being analyzed.
213
214 // static const char* const here = "ReadDatabase()";
215 char prefix[2];
216
217 // Read data from database
218 // Pull values from the THcParmList instead of reading a database
219 // file like Hall A does.
220
221 // We will probably want to add some kind of method to gHcParms to allow
222 // bulk retrieval of parameters of interest.
223
224 // Will need to determine which spectrometer in order to construct
225 // the parameter names (e.g. hscin_1x_nr vs. sscin_1x_nr)
226
227 prefix[0]=tolower(GetApparatus()->GetName()[0]);
228 prefix[1]='\0';
229
230 CreateMissReportParms(Form("%scal",prefix));
231
232 fNegCols = fNLayers; // If not defined assume tube on each end
233 // for every layer
234 {
235 DBRequest list[]={
236 {"cal_num_neg_columns", &fNegCols, kInt, 0, 1},
237 {"cal_slop", &fSlop, kDouble,0,1},
238 {"cal_fv_test", &fvTest, kInt,0,1},
239 {"cal_fv_delta", &fvDelta, kDouble,0,1},
240 {"cal_ADCMode", &fADCMode, kInt, 0, 1},
241 {"cal_adc_tdc_offset", &fAdcTdcOffset, kDouble, 0, 1},
242 {"dbg_raw_cal", &fdbg_raw_cal, kInt, 0, 1},
243 {"dbg_decoded_cal", &fdbg_decoded_cal, kInt, 0, 1},
244 {"dbg_sparsified_cal", &fdbg_sparsified_cal, kInt, 0, 1},
245 {"dbg_clusters_cal", &fdbg_clusters_cal, kInt, 0, 1},
246 {"dbg_tracks_cal", &fdbg_tracks_cal, kInt, 0, 1},
247 {"dbg_init_cal", &fdbg_init_cal, kInt, 0, 1},
248 {0}
249 };
250 fvTest = 0; // Default if not defined
251 fdbg_raw_cal = 0; // Debugging off by default
255 fdbg_tracks_cal = 0;
256 fdbg_init_cal = 0;
257 fAdcTdcOffset=0.0;
259 gHcParms->LoadParmValues((DBRequest*)&list, prefix);
260 }
261
262 // Debug output.
263 if (fdbg_init_cal) {
264 cout << "---------------------------------------------------------------\n";
265 cout << "Debug output from THcShower::ReadDatabase for "
266 << GetApparatus()->GetName() << endl;
267
268 cout << " Number of neg. columns = " << fNegCols << endl;
269 cout << " Slop parameter = " << fSlop << endl;
270 cout << " Fiducial volume test flag = " << fvTest << endl;
271 cout << " Fiducial volume excl. width = " << fvDelta << endl;
272 cout << " Initialize debug flag = " << fdbg_init_cal << endl;
273 cout << " Raw hit debug flag = " << fdbg_raw_cal << endl;
274 cout << " Decode debug flag = " << fdbg_decoded_cal << endl;
275 cout << " Sparsify debug flag = " << fdbg_sparsified_cal << endl;
276 cout << " Cluster debug flag = " << fdbg_clusters_cal << endl;
277 cout << " Tracking debug flag = " << fdbg_tracks_cal << endl;
278 }
279
280 {
281 DBRequest list[]={
282 {"cal_a_cor", &fAcor, kDouble},
283 {"cal_b_cor", &fBcor, kDouble},
284 {"cal_c_cor", fCcor, kDouble, 2},
285 {"cal_d_cor", fDcor, kDouble, 2},
286 {0}
287 };
288 gHcParms->LoadParmValues((DBRequest*)&list, prefix);
289 }
290
291 // Debug output.
292 if (fdbg_init_cal) {
293 cout << " Coordinate correction constants:\n";
294 cout << " fAcor = " << fAcor << endl;
295 cout << " fBcor = " << fBcor << endl;
296 cout << " fCcor = " << fCcor[0] << ", " << fCcor[1] << endl;
297 cout << " fDcor = " << fDcor[0] << ", " << fDcor[1] << endl;
298 }
299
301 fNBlocks = new UInt_t [fNLayers];
303 fYPos = new Double_t [2*fNLayers];
304
305 for(UInt_t i=0;i<fNLayers;i++) {
306 DBRequest list[]={
307 {Form("cal_%s_thick",fLayerNames[i]), &BlockThick[i], kDouble},
308 {Form("cal_%s_nr",fLayerNames[i]), &fNBlocks[i], kInt},
309 {Form("cal_%s_zpos",fLayerNames[i]), &fLayerZPos[i], kDouble},
310 {Form("cal_%s_right",fLayerNames[i]), &fYPos[2*i], kDouble},
311 {Form("cal_%s_left",fLayerNames[i]), &fYPos[2*i+1], kDouble},
312 {0}
313 };
314 gHcParms->LoadParmValues((DBRequest*)&list, prefix);
315 }
316
317 //Caution! Z positions (fronts) are off in hcal.param! Correct later on.
318
319 fXPos = new Double_t* [fNLayers];
320 for(UInt_t i=0;i<fNLayers;i++) {
321 fXPos[i] = new Double_t [fNBlocks[i]];
322 DBRequest list[]={
323 {Form("cal_%s_top",fLayerNames[i]),fXPos[i], kDouble, fNBlocks[i]},
324 {0}
325 };
326 gHcParms->LoadParmValues((DBRequest*)&list, prefix);
327 }
328
329 // Debug output.
330 if (fdbg_init_cal) {
331 for(UInt_t i=0;i<fNLayers;i++) {
332 cout << " Plane " << fLayerNames[i] << ":" << endl;
333 cout << " Block thickness: " << BlockThick[i] << endl;
334 cout << " NBlocks : " << fNBlocks[i] << endl;
335 cout << " Z Position : " << fLayerZPos[i] << endl;
336 cout << " Y Positions : " << fYPos[2*i] << ", " << fYPos[2*i+1]
337 <<endl;
338 cout << " X Positions :";
339 for(UInt_t j=0; j<fNBlocks[i]; j++) {
340 cout << " " << fXPos[i][j];
341 }
342 cout << endl;
343 }
344 }
345
346 // Fiducial volume limits, based on Plane 1 positions.
347 //
348
349 fvXmin = fXPos[0][0] + fvDelta;
350 fvXmax = fXPos[0][fNBlocks[0]-1] + BlockThick[0] - fvDelta;
351 fvYmin = fYPos[0] + fvDelta;
352 fvYmax = fYPos[1] - fvDelta;
353
354 // Debug output.
355 if (fdbg_init_cal) {
356 cout << " Fiducial volume limits:" << endl;
357 cout << " Xmin = " << fvXmin << " Xmax = " << fvXmax << endl;
358 cout << " Ymin = " << fvYmin << " Ymax = " << fvYmax << endl;
359 }
360
361 //Calibration related parameters (from h(s)cal.param).
362
363 fNTotBlocks=0; //total number of blocks in the layers
364 for (UInt_t i=0; i<fNLayers; i++) fNTotBlocks += fNBlocks[i];
365
366 // Debug output.
367 if (fdbg_init_cal)
368 cout << " Total number of blocks in the layers of calorimeter: " << dec
369 << fNTotBlocks << endl;
370
371 //Pedestal limits from hcal.param.
374 for (UInt_t i=0; i<fNTotBlocks; i++) {
375 fShPosPedLimit[i]=0.;
376 fShNegPedLimit[i]=0.;
377 }
378
379 //Calibration constants
382
383 //Read in parameters from hcal.param
384 Double_t hcal_pos_cal_const[fNTotBlocks];
385 Double_t hcal_pos_gain_cor[fNTotBlocks];
386
387 Double_t hcal_neg_cal_const[fNTotBlocks];
388 Double_t hcal_neg_gain_cor[fNTotBlocks];
389
396
397 DBRequest list[]={
398 {"cal_pos_cal_const", hcal_pos_cal_const, kDouble, fNTotBlocks},
399 {"cal_pos_ped_limit", fShPosPedLimit, kInt, fNTotBlocks,1},
400 {"cal_pos_gain_cor", hcal_pos_gain_cor, kDouble, fNTotBlocks},
401 {"cal_neg_cal_const", hcal_neg_cal_const, kDouble, fNTotBlocks},
402 {"cal_neg_ped_limit", fShNegPedLimit, kInt, fNTotBlocks,1},
403 {"cal_neg_gain_cor", hcal_neg_gain_cor, kDouble, fNTotBlocks},
404 {"cal_pos_AdcTimeWindowMin", fPosAdcTimeWindowMin, kDouble, static_cast<UInt_t>(fNTotBlocks),1},
405 {"cal_neg_AdcTimeWindowMin", fNegAdcTimeWindowMin, kDouble, static_cast<UInt_t>(fNTotBlocks),1},
406 {"cal_pos_AdcTimeWindowMax", fPosAdcTimeWindowMax, kDouble, static_cast<UInt_t>(fNTotBlocks),1},
407 {"cal_neg_AdcTimeWindowMax", fNegAdcTimeWindowMax, kDouble, static_cast<UInt_t>(fNTotBlocks),1},
408 {"cal_PedNegDefault", fPedNegDefault, kInt, static_cast<UInt_t>(fNTotBlocks),1},
409 {"cal_PedPosDefault", fPedNegDefault, kInt, static_cast<UInt_t>(fNTotBlocks),1},
410 {"cal_min_peds", &fShMinPeds, kInt,0,1},
411 {0}
412 };
413 fShMinPeds=0.;
414
415 for(UInt_t ip=0;ip<fNTotBlocks;ip++) {
416 fPosAdcTimeWindowMin[ip] = -1000.;
417 fNegAdcTimeWindowMin[ip] = -1000.;
418 fPosAdcTimeWindowMax[ip] = 1000.;
419 fNegAdcTimeWindowMax[ip] = 1000.;
420 fPedNegDefault[ip] = 0;
421 fPedPosDefault[ip] = 0;
422 }
423
424 gHcParms->LoadParmValues((DBRequest*)&list, prefix);
425
426 // Debug output.
427 if (fdbg_init_cal) {
428
429 cout << " hcal_pos_cal_const:" << endl;
430 for (UInt_t j=0; j<fNLayers; j++) {
431 cout << " ";
432 for (UInt_t i=0; i<fNBlocks[j]; i++) {
433 cout << hcal_pos_cal_const[j*fNBlocks[j]+i] << " ";
434 };
435 cout << endl;
436 };
437
438 cout << " fShPosPedLimit:" << endl;
439 for (UInt_t j=0; j<fNLayers; j++) {
440 cout << " ";
441 for (UInt_t i=0; i<fNBlocks[j]; i++) {
442 cout << fShPosPedLimit[j*fNBlocks[j]+i] << " ";
443 };
444 cout << endl;
445 };
446
447 cout << " hcal_pos_gain_cor:" << endl;
448 for (UInt_t j=0; j<fNLayers; j++) {
449 cout << " ";
450 for (UInt_t i=0; i<fNBlocks[j]; i++) {
451 cout << hcal_pos_gain_cor[j*fNBlocks[j]+i] << " ";
452 };
453 cout << endl;
454 };
455
456 cout << " hcal_neg_cal_const:" << endl;
457 for (UInt_t j=0; j<fNLayers; j++) {
458 cout << " ";
459 for (UInt_t i=0; i<fNBlocks[j]; i++) {
460 cout << hcal_neg_cal_const[j*fNBlocks[j]+i] << " ";
461 };
462 cout << endl;
463 };
464
465 cout << " fShNegPedLimit:" << endl;
466 for (UInt_t j=0; j<fNLayers; j++) {
467 cout << " ";
468 for (UInt_t i=0; i<fNBlocks[j]; i++) {
469 cout << fShNegPedLimit[j*fNBlocks[j]+i] << " ";
470 };
471 cout << endl;
472 };
473
474 cout << " hcal_neg_gain_cor:" << endl;
475 for (UInt_t j=0; j<fNLayers; j++) {
476 cout << " ";
477 for (UInt_t i=0; i<fNBlocks[j]; i++) {
478 cout << hcal_neg_gain_cor[j*fNBlocks[j]+i] << " ";
479 };
480 cout << endl;
481 };
482
483 } // end of debug output
484
485 // Calibration constants (GeV / ADC channel).
486
487 for (UInt_t i=0; i<fNTotBlocks; i++) {
488 fPosGain[i] = hcal_pos_cal_const[i] * hcal_pos_gain_cor[i];
489 fNegGain[i] = hcal_neg_cal_const[i] * hcal_neg_gain_cor[i];
490 }
491
492 // Debug output.
493 if (fdbg_init_cal) {
494
495 cout << " fPosGain:" << endl;
496 for (UInt_t j=0; j<fNLayers; j++) {
497 cout << " ";
498 for (UInt_t i=0; i<fNBlocks[j]; i++) {
499 cout << fPosGain[j*fNBlocks[j]+i] << " ";
500 };
501 cout << endl;
502 };
503
504 cout << " fNegGain:" << endl;
505 for (UInt_t j=0; j<fNLayers; j++) {
506 cout << " ";
507 for (UInt_t i=0; i<fNBlocks[j]; i++) {
508 cout << fNegGain[j*fNBlocks[j]+i] << " ";
509 };
510 cout << endl;
511 };
512
513 }
514
515 // Origin of the calorimeter, at the centre of the face of the detector,
516 // or at the centre of the front of the 1-st layer.
517 //
518 Double_t xOrig = (fXPos[0][0] + fXPos[0][fNBlocks[0]-1])/2 + BlockThick[0]/2;
519 Double_t yOrig = (fYPos[0] + fYPos[1])/2;
520 Double_t zOrig = fLayerZPos[0];
521
522 fOrigin.SetXYZ(xOrig, yOrig, zOrig);
523
524 // Debug output.
525 if (fdbg_init_cal) {
526 cout << " Origin of the Calorimeter:" << endl;
527 cout << " Xorig = " << GetOrigin().X() << endl;
528 cout << " Yorig = " << GetOrigin().Y() << endl;
529 cout << " Zorig = " << GetOrigin().Z() << endl;
530 cout << "---------------------------------------------------------------\n";
531 }
532
533 // Detector axes. Assume no rotation.
534 //
535 DefineAxes(0.);
536
537 fIsInit = true;
538
539 return kOK;
540}
541
542
543//_____________________________________________________________________________
545{
546 // Initialize global variables and lookup table for decoder
547
548 if( mode == kDefine && fIsSetup ) return kOK;
549 fIsSetup = ( mode == kDefine );
550
551 // Register variables in global list
552
553 RVarDef vars[] = {
554 { "nhits", "Number of hits", "fNhits" },
555 { "nclust", "Number of layer clusters", "fNclust" },
556 { "nclusttrack", "Number of layer cluster which matched best track","fNclustTrack" },
557 { "xclusttrack", "X pos of layer cluster which matched best track","fXclustTrack" },
558 { "xtrack", "X pos of track which matched layer cluster", "fXTrack" },
559 { "yclusttrack", "Y pos of layer cluster which matched best track","fYclustTrack" },
560 { "ytrack", "Y pos of track which matched layer cluster", "fYTrack" },
561 { "etot", "Total energy", "fEtot" },
562 { "etotnorm", "Total energy divided by Central Momentum", "fEtotNorm" },
563 { "etrack", "Track energy", "fEtrack" },
564 { "etracknorm", "Total energy divided by track momentum", "fEtrackNorm" },
565 { "eprtrack", "Track Preshower energy", "fEPRtrack" },
566 { "eprtracknorm", "Preshower energy divided by track momentum", "fEPRtrackNorm" },
567 { "etottracknorm", "Total energy divided by track momentum", "fETotTrackNorm" },
568 { "ntracks", "Number of shower tracks", "fNtracks" },
569 { 0 }
570 };
571
572 if(fHasArray) {
573
574 RVarDef array_vars[] = {
575 { "sizeclustarray", "Number of block in array cluster that matches track", "fSizeClustArray" },
576 { "nclustarraytrack", "Number of cluster for Fly's eye which matched best track","fNclustArrayTrack" },
577 { "nblock_high_ene", "Block number in array with highest energy which matched best track","fNblockHighEnergy" },
578 { "xclustarraytrack", "X pos of cluster which matched best track","fXclustArrayTrack" },
579 { "xtrackarray", "X pos of track which matched cluster", "fXTrackArray" },
580 { "yclustarraytrack", "Y pos of cluster which matched best track","fYclustArrayTrack" },
581 { "ytrackarray", "Y pos of track which matched cluster", "fYTrackArray" },
582 { 0 }
583 };
584
585 DefineVarsFromList( array_vars, mode );
586 }
587 return DefineVarsFromList( vars, mode );
588
589}
590
591//_____________________________________________________________________________
593{
594 // Destructor. Remove variables from global list.
595
596 Clear();
597 if( fIsSetup )
599 if( fIsInit )
600 DeleteArrays();
601
602 for (THcShowerClusterListIt i=fClusterList->begin(); i!=fClusterList->end();
603 ++i) {
604 Podd::DeleteContainer(**i);
605 delete *i;
606 }
607 delete fClusterList; fClusterList = 0;
608
609 for( UInt_t i = 0; i<fNLayers; ++i) {
610 delete fPlanes[i];
611 }
612 delete [] fPlanes; fPlanes = 0;
613 delete fArray; fArray = 0;
614}
615
616//_____________________________________________________________________________
618{
619 // Delete member arrays. Used by destructor.
620
621 for (UInt_t i = 0; i<fNTotLayers; ++i)
622 delete [] fLayerNames[i];
623 delete [] fLayerNames; fLayerNames = 0;
624
629 delete [] fPedNegDefault; fPedNegDefault = 0;
630 delete [] fPedPosDefault; fPedPosDefault = 0;
631 delete [] fShPosPedLimit; fShPosPedLimit = 0;
632 delete [] fShNegPedLimit; fShNegPedLimit = 0;
633 delete [] fPosGain; fPosGain = 0;
634 delete [] fNegGain; fNegGain = 0;
635 delete [] BlockThick; BlockThick = NULL;
636 delete [] fNBlocks; fNBlocks = NULL;
637 delete [] fLayerZPos; fLayerZPos = NULL;
638 for (UInt_t i = 0; i<fNLayers; ++i)
639 delete [] fXPos[i];
640 delete [] fXPos; fXPos = NULL;
641 delete [] fYPos; fYPos = NULL;
642 delete [] fZPos; fZPos = NULL;
643}
644
645//_____________________________________________________________________________
646inline
648{
649
650// Reset per-event data.
651
652 for(UInt_t ip=0;ip<fNLayers;ip++) {
653 fPlanes[ip]->Clear(opt);
654 }
655 if(fHasArray) {
656 fArray->Clear(opt);
657 }
658
659 fNhits = 0;
660 fNclust = 0;
661 fNclustTrack = -2;
662 fXclustTrack = -1000;
663 fXTrack = -1000;
664 fYclustTrack = -1000;
665 fYTrack = -1000;
667 fXclustArrayTrack = -1000;
668 fXTrackArray = -1000;
669 fYclustArrayTrack = -1000;
670 fYTrackArray = -1000;
671 fNtracks = 0;
672 fEtot = 0.;
673 fEtotNorm = 0.;
674 fEtrack = 0.;
675 fEtrackNorm = 0.;
676 fEPRtrack = 0.;
677 fEPRtrackNorm = 0.;
678 fETotTrackNorm = 0.;
679 fSizeClustArray = 0;
681
682 // Purge cluster list
683
684 for (THcShowerClusterListIt i=fClusterList->begin(); i!=fClusterList->end();
685 ++i) {
686 Podd::DeleteContainer(**i);
687 delete *i;
688 }
689 fClusterList->clear();
690}
691
692//_____________________________________________________________________________
694{
695
696 Clear();
697
698 // Get the Hall C style hitlist (fRawHitList) for this event
699 Bool_t present = kTRUE; // Suppress reference time warnings
700 if(fPresentP) { // if this spectrometer not part of trigger
701 present = *fPresentP;
702 }
703 Int_t nhits = DecodeToHitList(evdata, !present);
704
705 fEvent = evdata.GetEvNum();
706
707 if(gHaCuts->Result("Pedestal_event")) {
708 Int_t nexthit = 0;
709 for(UInt_t ip=0;ip<fNLayers;ip++) {
710 nexthit = fPlanes[ip]->AccumulatePedestals(fRawHitList, nexthit);
711 }
712 if(fHasArray) {
713 nexthit = fArray->AccumulatePedestals(fRawHitList, nexthit);
714 }
715 fAnalyzePedestals = 1; // Analyze pedestals first normal events
716 return(0);
717 }
718
720 for(UInt_t ip=0;ip<fNLayers;ip++) {
722 }
723 if(fHasArray) {
725 }
726 fAnalyzePedestals = 0; // Don't analyze pedestals next event
727 }
728
729 Int_t nexthit = 0;
730 for(UInt_t ip=0;ip<fNLayers;ip++) {
731 nexthit = fPlanes[ip]->ProcessHits(fRawHitList, nexthit);
732 }
733 if(fHasArray) {
734 nexthit = fArray->ProcessHits(fRawHitList, nexthit);
735 }
736
737 return nhits;
738}
739
740//_____________________________________________________________________________
742{
743 // Calculation of coordinates of particle track cross point with shower
744 // plane in the detector coordinate system. For this, parameters of track
745 // reconstructed in THaVDC::CoarseTrack() are used.
746 //
747 // Apply corrections and reconstruct the complete hits.
748
749 // Clustering of hits.
750 //
751
752 // Fill set of unclustered hits.
753 for(UInt_t ip=0;ip<fNLayers;ip++) {
755 fEtot += fPlanes[ip]->GetEplane();
756 }
757 if(fHasArray) {
759 fEtot += fArray->GetEarray();
760 }
762 fEtotNorm=fEtot/(app->GetPcentral());
763 //
764 THcShowerHitSet HitSet;
765
766 for(UInt_t j=0; j < fNLayers; j++) {
767
768 for (UInt_t i=0; i<fNBlocks[j]; i++) {
769
770 //
771 if (fPlanes[j]->GetAposP(i) > 0 || fPlanes[j]->GetAnegP(i) >0) { //hit
772
773 Double_t Edep = fPlanes[j]->GetEmean(i);
774 Double_t Epos = fPlanes[j]->GetEpos(i);
775 Double_t Eneg = fPlanes[j]->GetEneg(i);
776 Double_t x = fXPos[j][i] + BlockThick[j]/2.; //top + thick/2
777 Double_t y=-1000;
778 if (fHasArray) {
779 if (Eneg>0) y = fYPos[2*j]/2 ;
780 if (Epos>0) y = fYPos[2*j+1]/2 ;
781 if (Epos>0 && Eneg>0) y = 0. ;
782 } else {
783 y=0.;
784 }
785 Double_t z = fLayerZPos[j] + BlockThick[j]/2.; //front + thick/2
786
787 THcShowerHit* hit = new THcShowerHit(i,j,x,y,z,Edep,Epos,Eneg);
788
789 HitSet.insert(hit); //<set> version
790 }
791
792 }
793 }
794
795 fNhits = HitSet.size();
796
797 //Debug output, print out hits before clustering.
798
799 if (fdbg_clusters_cal) {
800 cout << "---------------------------------------------------------------\n";
801 cout << "Debug output from THcShower::CoarseProcess for "
802 << GetApparatus()->GetName() << endl;
803
804 cout << " event = " << fEvent << endl;
805 cout << " List of unclustered hits. Total hits: " << fNhits << endl;
806 THcShowerHitIt it = HitSet.begin(); //<set> version
807 for (Int_t i=0; i!=fNhits; i++) {
808 cout << " hit " << i << ": ";
809 (*(it++))->show();
810 }
811 }
812
813 // Fill list of clusters.
814
815 ClusterHits(HitSet, fClusterList);
816 assert( HitSet.empty() ); // else bug in ClusterHits()
817
818 fNclust = (*fClusterList).size(); //number of clusters
819
820 //Debug output, print out the cluster list.
821
822 if (fdbg_clusters_cal) {
823
824 cout << " event = " << fEvent << " Clustered hits. Number of clusters: " << fNclust << endl;
825
826 UInt_t i = 0;
827 for (THcShowerClusterListIt ppcl = (*fClusterList).begin();
828 ppcl != (*fClusterList).end(); ++ppcl) {
829
830 cout << " Cluster #" << i++
831 <<": E=" << clE(*ppcl)
832 << " Epr=" << clEpr(*ppcl)
833 << " X=" << clX(*ppcl)
834 << " Z=" << clZ(*ppcl)
835 << " size=" << (**ppcl).size()
836 << endl;
837
838 Int_t j=0;
839 for (THcShowerClusterIt pph=(**ppcl).begin(); pph!=(**ppcl).end();
840 ++pph) {
841 cout << " hit " << j++ << ": ";
842 (**pph).show();
843 }
844
845 }
846
847 cout << "---------------------------------------------------------------\n";
848 }
849
850 // Do same for Array.
851
853
854 //
855 Int_t Ntracks = tracks.GetLast()+1; // Number of reconstructed tracks
856 Double_t save_energy=0;
857 for (Int_t itrk=0; itrk<Ntracks; itrk++) {
858
859 THaTrack* theTrack = static_cast<THaTrack*>( tracks[itrk] );
860 // save_energy = GetShEnergy(theTrack);
861 save_energy = GetShEnergy(theTrack, fNLayers);
862 if (fHasArray) save_energy += fArray->GetShEnergy(theTrack);
863 theTrack->SetEnergy(save_energy);
864 } //over tracks
865
866 //
867 return 0;
868}
869
870//-----------------------------------------------------------------------------
871
873 THcShowerClusterList* ClusterList) {
874
875 // Collect hits from the HitSet into the clusters. The resultant clusters
876 // of hits are saved in the ClusterList.
877
878 while (HitSet.size() != 0) {
879
880 THcShowerCluster* cluster = new THcShowerCluster;
881
882 THcShowerHitIt it = HitSet.end();
883 (*cluster).insert(*(--it)); //Move the last hit from the hit list
884 HitSet.erase(it); //into the 1st cluster
885
886 bool clustered = true;
887
888 while (clustered) { //Proceed while a hit is clustered
889
890 clustered = false;
891
892 for (THcShowerHitIt i=HitSet.begin(); i!=HitSet.end(); ++i) {
893
894 for (THcShowerClusterIt k=(*cluster).begin(); k!=(*cluster).end();
895 ++k) {
896
897 if ((**i).isNeighbour(*k)) {
898 (*cluster).insert(*i); //If the hit #i is neighbouring a hit
899 HitSet.erase(i); //in the cluster, then move it
900 //into the cluster.
901 clustered = true;
902 }
903
904 if (clustered) break;
905 } //k
906
907 if (clustered) break;
908 } //i
909
910 } //while clustered
911
912 ClusterList->push_back(cluster); //Put the cluster in the cluster list
913
914 } //While hit_list not exhausted
915
916};
917
918//-----------------------------------------------------------------------------
919
920// Various helper functions to accumulate hit related quantities.
921
923 return x + h->hitE();
924}
925
927 return x + h->hitE() * h->hitX();
928}
929
931 return x + h->hitE() * h->hitY();
932}
933
935 return x + h->hitE() * h->hitZ();
936}
937
939 return h->hitColumn() == 0 ? x + h->hitE() : x;
940}
941
943 return x + h->hitEpos();
944}
945
947 return x + h->hitEneg();
948}
949
950// Y coordinate of center of gravity of cluster, calculated as hit energy
951// weighted average. Put X out of the calorimeter (-100 cm), if there is no
952// energy deposition in the cluster.
953//
955 Double_t Etot = accumulate((*cluster).begin(),(*cluster).end(),0.,addE);
956 return (Etot != 0. ?
957 accumulate((*cluster).begin(),(*cluster).end(),0.,addY)/Etot : -100.);
958}
959// X coordinate of center of gravity of cluster, calculated as hit energy
960// weighted average. Put X out of the calorimeter (-100 cm), if there is no
961// energy deposition in the cluster.
962//
964 Double_t Etot = accumulate((*cluster).begin(),(*cluster).end(),0.,addE);
965 return (Etot != 0. ?
966 accumulate((*cluster).begin(),(*cluster).end(),0.,addX)/Etot : -100.);
967}
968
969// Z coordinate of center of gravity of cluster, calculated as a hit energy
970// weighted average. Put Z out of the calorimeter (0 cm), if there is no energy
971// deposition in the cluster.
972//
974 Double_t Etot = accumulate((*cluster).begin(),(*cluster).end(),0.,addE);
975 return (Etot != 0. ?
976 accumulate((*cluster).begin(),(*cluster).end(),0.,addZ)/Etot : 0.);
977}
978
979//Energy depostion in a cluster
980//
982 return accumulate((*cluster).begin(),(*cluster).end(),0.,addE);
983}
984
985//Energy deposition in the Preshower (1st plane) for a cluster
986//
988 return accumulate((*cluster).begin(),(*cluster).end(),0.,addEpr);
989}
990
991//Cluster energy deposition in plane iplane=0,..,3:
992// side=0 -- from positive PMTs only;
993// side=1 -- from negative PMTs only;
994// side=2 -- from postive and negative PMTs.
995//
996
998
999 if (side!=0&&side!=1&&side!=2) {
1000 cout << "*** Wrong Side in clEplane:" << side << " ***" << endl;
1001 return -1;
1002 }
1003
1004 THcShowerHitSet pcluster;
1005 for (THcShowerHitIt it=(*cluster).begin(); it!=(*cluster).end(); ++it) {
1006 if ((*it)->hitColumn() == iplane) pcluster.insert(*it);
1007 }
1008
1009 Double_t Eplane;
1010 switch (side) {
1011 case 0 :
1012 Eplane = accumulate(pcluster.begin(),pcluster.end(),0.,addEpos);
1013 break;
1014 case 1 :
1015 Eplane = accumulate(pcluster.begin(),pcluster.end(),0.,addEneg);
1016 break;
1017 case 2 :
1018 Eplane = accumulate(pcluster.begin(),pcluster.end(),0.,addE);
1019 break;
1020 default :
1021 Eplane = 0. ;
1022 }
1023
1024 return Eplane;
1025}
1026
1027//-----------------------------------------------------------------------------
1028
1030 Double_t& XTrFront, Double_t& YTrFront)
1031{
1032 // Match a cluster to a given track. Return the cluster number,
1033 // and track coordinates at the front of calorimeter.
1034
1035 XTrFront = kBig;
1036 YTrFront = kBig;
1037 Double_t pathl = kBig;
1038
1039 // Track interception with face of the calorimeter. The coordinates are
1040 // in the calorimeter's local system.
1041
1042 fOrigin = fPlanes[0]->GetOrigin();
1043
1044 CalcTrackIntercept(Track, pathl, XTrFront, YTrFront);
1045
1046 // Transform coordiantes to the spectrometer's coordinate system.
1047
1048 XTrFront += GetOrigin().X();
1049 YTrFront += GetOrigin().Y();
1050
1051 Bool_t inFidVol = true; // In Fiducial Volume flag
1052
1053 // Re-evaluate Fid. Volume Flag if fid. volume test is requested
1054
1055 if (fvTest) {
1056
1057 // Track coordinates at the back of the detector.
1058
1059 // Origin at the front of the last layer.
1061
1062 Double_t XTrBack = kBig;
1063 Double_t YTrBack = kBig;
1064
1065 CalcTrackIntercept(Track, pathl, XTrBack, YTrBack);
1066
1067 XTrBack += GetOrigin().X(); // from local coord. system
1068 YTrBack += GetOrigin().Y(); // to the spectrometer system
1069
1070 inFidVol = (XTrFront <= fvXmax) && (XTrFront >= fvXmin) &&
1071 (YTrFront <= fvYmax) && (YTrFront >= fvYmin) &&
1072 (XTrBack <= fvXmax) && (XTrBack >= fvXmin) &&
1073 (YTrBack <= fvYmax) && (YTrBack >= fvYmin);
1074
1075 }
1076
1077 // Match a cluster to the track.
1078
1079 Int_t mclust = -1; // The match cluster #, initialize with a bogus value.
1080 Double_t deltaX = kBig; // Track to cluster distance
1081
1082 if (inFidVol) {
1083
1084 // Since hits and clusters are in reverse order (with respect to Engine),
1085 // search backwards to be consistent with Engine.
1086 //
1087 for (Int_t i=fNclust-1; i>-1; i--) {
1088
1089 THcShowerCluster* cluster = *(fClusterList->begin()+i);
1090
1091 Double_t dx = TMath::Abs( clX(cluster) - XTrFront );
1092
1093 if (dx <= (0.5*BlockThick[0] + fSlop)) {
1094 fNtracks++; // lumber of shower tracks (Consistent with engine)
1095 if (dx < deltaX) {
1096 mclust = i;
1097 deltaX = dx;
1098 }
1099 }
1100 }
1101 }
1102
1103 //Debug output.
1104
1105 if (fdbg_tracks_cal) {
1106 cout << "---------------------------------------------------------------\n";
1107 cout << "Debug output from THcShower::MatchCluster for "
1108 << GetApparatus()->GetName() << endl;
1109 cout << " event = " << fEvent << endl;
1110
1111 cout << " Track at DC:"
1112 << " X = " << Track->GetX()
1113 << " Y = " << Track->GetY()
1114 << " Theta = " << Track->GetTheta()
1115 << " Phi = " << Track->GetPhi()
1116 << endl;
1117 cout << " Track at the front of Calorimeter:"
1118 << " X = " << XTrFront
1119 << " Y = " << YTrFront
1120 << " Pathl = " << pathl
1121 << endl;
1122 if (fvTest)
1123 cout << " Fiducial volume test: inFidVol = " << inFidVol << endl;
1124
1125 cout << " Matched cluster #" << mclust << ", delatX= " << deltaX
1126 << endl;
1127 cout << "---------------------------------------------------------------\n";
1128 }
1129
1130 return mclust;
1131}
1132
1133//_____________________________________________________________________________
1135
1136 // Get part of energy deposited in the cluster matched to the given
1137 // spectrometer Track, limited by range of layers from L0 to L0+NLayers-1.
1138
1139 // Track coordinates at front of the calorimeter, initialize out of
1140 // acceptance.
1141 Double_t Xtr = -100.;
1142 Double_t Ytr = -100.;
1143
1144 // Associate a cluster to the track.
1145
1146 Int_t mclust = MatchCluster(Track, Xtr, Ytr);
1147
1148 // Coordinate corrected total energy deposition in the cluster.
1149
1150 Float_t Etrk = 0.;
1151 if (mclust >= 0) { // if there is a matched cluster
1152
1153 // Get matched cluster.
1154
1155 THcShowerCluster* cluster = *(fClusterList->begin()+mclust);
1156
1157 char prefix = GetApparatus()->GetName()[0];
1158
1159 // Correct track energy depositions for the impact coordinate.
1160
1161 // for (UInt_t ip=0; ip<fNLayers; ip++) {
1162 for (UInt_t ip=L0; ip<L0+NLayers; ip++) {
1163
1164 // Coordinate correction factors for positive and negative sides,
1165 // different for double PMT counters in the 1-st two HMS layes,
1166 // single PMT counters in the rear two HMS layers, and in the SHMS
1167 // Preshower.
1168 Float_t corpos = 1.;
1169 Float_t corneg = 1.;
1170
1171 if (ip < fNegCols) {
1172 if (prefix == 'H') { //HMS 1-st 2 layers
1173 corpos = Ycor(Ytr,0);
1174 corneg = Ycor(Ytr,1);
1175 }
1176 else { //SHMS Preshower
1177 corpos = YcorPr(Ytr,0);
1178 corneg = YcorPr(Ytr,1);
1179 }
1180 }
1181 else {
1182 corpos = Ycor(Ytr);
1183 corneg = 0.;
1184 }
1185
1186 // cout << ip << " clust energy pos = " << clEplane(cluster,ip,0)<< " clust energy neg = " << clEplane(cluster,ip,1) << endl;
1187 Etrk += clEplane(cluster,ip,0) * corpos;
1188 Etrk += clEplane(cluster,ip,1) * corneg;
1189
1190 } //over planes
1191
1192 } //mclust>=0
1193
1194 //Debug output.
1195
1196 if (fdbg_tracks_cal) {
1197 cout << "---------------------------------------------------------------\n";
1198 cout << "Debug output from THcShower::GetShEnergy for "
1199 << GetApparatus()->GetName() << endl;
1200 cout << " event = " << fEvent << endl;
1201
1202 cout << " Track at the calorimeter: X = " << Xtr << " Y = " << Ytr;
1203 if (mclust >= 0)
1204 cout << ", matched cluster #" << mclust << "." << endl;
1205 else
1206 cout << ", no matched cluster found." << endl;
1207
1208 cout << " Layers from " << L0+1 << " to " << L0+NLayers << ".\n";
1209 cout << " Coordinate corrected track energy = " << Etrk << "." << endl;
1210 cout << "---------------------------------------------------------------\n";
1211 }
1212
1213 return Etrk;
1214}
1215
1216//_____________________________________________________________________________
1218{
1219
1220 // Shower energy assignment to the spectrometer tracks.
1221 //
1222
1223 Int_t Ntracks = tracks.GetLast()+1; // Number of reconstructed tracks
1224 Double_t Xtr = -100.;
1225 Double_t Ytr = -100.;
1226 for (Int_t itrk=0; itrk<Ntracks; itrk++) {
1227 THaTrack* theTrack = static_cast<THaTrack*>( tracks[itrk] );
1228 if (theTrack->GetIndex()==0) {
1229 fEtrack=theTrack->GetEnergy();
1230 fEtrackNorm=fEtrack/theTrack->GetP();
1231 fEPRtrack=GetShEnergy(theTrack,1);
1232 fEPRtrackNorm=fEPRtrack/theTrack->GetP();
1233 fETotTrackNorm=fEtot/theTrack->GetP();
1234 Xtr = -100.;
1235 Ytr = -100.;
1236 fNclustTrack = MatchCluster(theTrack, Xtr, Ytr);
1237 fXTrack=Xtr;
1238 fYTrack=Ytr;
1239 if (fNclustTrack>=0) {
1240 THcShowerCluster* cluster = *(fClusterList->begin()+fNclustTrack);
1241 fXclustTrack=clX(cluster);
1242 fYclustTrack=clY(cluster);
1243 }
1244 if (fHasArray) {
1245 fNclustArrayTrack = fArray->MatchCluster(theTrack,Xtr,Ytr);
1246 if (fNclustArrayTrack>=0) {
1251 fXTrackArray=Xtr;
1252 fYTrackArray=Ytr;
1253 }
1254 }
1255 }
1256 } //over tracks
1257
1258 if (Ntracks>0) {
1259 for(UInt_t ip=0;ip<fNLayers;ip++) {
1260 fPlanes[ip]-> AccumulateStat(tracks);
1261 }
1263 }
1264
1265 //Debug output.
1266
1267 if (fdbg_tracks_cal) {
1268 cout << "---------------------------------------------------------------\n";
1269 cout << "Debug output from THcShower::FineProcess for "
1270 << GetApparatus()->GetName() << endl;
1271 cout << " event = " << fEvent << endl;
1272 cout << " Number of tracks = " << Ntracks << endl;
1273 if (fNclustTrack>=0) {
1274 cout << " matching cluster info " << endl;
1275 cout << " X info = " << fXclustTrack << " " << Xtr << " " << fXclustTrack-Xtr << endl;
1276 cout << " Y info = " << fYclustTrack << " " << Ytr << " " << fYclustTrack-Ytr << endl;
1277 }
1278
1279 for (Int_t itrk=0; itrk<Ntracks; itrk++) {
1280 THaTrack* theTrack = static_cast<THaTrack*>( tracks[itrk] );
1281 cout << " Track " << itrk << ": "
1282 << " X = " << theTrack->GetX()
1283 << " Y = " << theTrack->GetY()
1284 << " Theta = " << theTrack->GetTheta()
1285 << " Phi = " << theTrack->GetPhi()
1286 << " Energy = " << theTrack->GetEnergy()
1287 << " Energy/Ptrack = " << fEtrackNorm << endl;
1288 }
1289
1290 cout << "---------------------------------------------------------------\n";
1291 }
1292
1293 return 0;
1294}
1295
1299//_____________________________________________________________________________
1301{
1302 MissReport(Form("%s.%s", GetApparatus()->GetName(), GetName()));
1303 return 0;
1304}
1305
int Int_t
unsigned int UInt_t
const Data_t kBig
bool Bool_t
float Float_t
double Double_t
const Bool_t kTRUE
const char Option_t
Option_t Option_t TPoint TPoint const char mode
R__EXTERN class THaVarList * gHaVars
R__EXTERN class THaCutList * gHaCuts
ClassImp(VDC::AnalyticTTDConv) using namespace std
R__EXTERN class THcParmList * gHcParms
Definition THcGlobals.h:11
R__EXTERN class THcDetectorMap * gHcDetectorMap
Definition THcGlobals.h:12
THcShowerClusterList::iterator THcShowerClusterListIt
THcShowerHitSet::iterator THcShowerHitIt
THcShowerCluster::iterator THcShowerClusterIt
THcShowerHitSet THcShowerCluster
vector< THcShowerCluster * > THcShowerClusterList
set< THcShowerHit * > THcShowerHitSet
Double_t addZ(Double_t x, THcShowerHit *h)
Double_t addE(Double_t x, THcShowerHit *h)
Double_t addY(Double_t x, THcShowerHit *h)
Double_t clE(THcShowerCluster *cluster)
Double_t addEpos(Double_t x, THcShowerHit *h)
Double_t clEplane(THcShowerCluster *cluster, Int_t iplane, Int_t side)
Double_t addEneg(Double_t x, THcShowerHit *h)
Double_t clX(THcShowerCluster *cluster)
Double_t addX(Double_t x, THcShowerHit *h)
Double_t clEpr(THcShowerCluster *cluster)
Double_t clZ(THcShowerCluster *cluster)
Double_t addEpr(Double_t x, THcShowerHit *h)
Double_t clY(THcShowerCluster *cluster)
Double_t clE(THcShowerCluster *cluster)
Double_t clEplane(THcShowerCluster *cluster, Int_t iplane, Int_t side)
Double_t clX(THcShowerCluster *cluster)
Double_t clEpr(THcShowerCluster *cluster)
Double_t clZ(THcShowerCluster *cluster)
Double_t clY(THcShowerCluster *cluster)
char * Form(const char *fmt,...)
static Int_t DefineVarsFromList(const void *list, EType type, EMode mode, const char *def_prefix, const TObject *obj, const char *prefix, const char *here, const char *comment_subst="")
virtual const char * Here(const char *) const
Int_t RemoveVariables()
virtual Int_t Result(const char *cutname="", EWarnMode mode=kWarn)
UInt_t GetTotNumChan() const
THaDetMap * fDetMap
virtual void DefineAxes(Double_t rotation_angle)
TVector3 fOrigin
const TVector3 & GetOrigin() const
THaApparatus * GetApparatus() const
UInt_t GetEvNum() const
Bool_t CalcTrackIntercept(THaTrack *track, Double_t &pathl, Double_t &xdet, Double_t &ydet)
Double_t GetX() const
Double_t GetPhi() const
Double_t GetEnergy() const
Double_t GetTheta() const
Double_t GetY() const
Int_t GetIndex() const
Double_t GetP() const
void SetEnergy(Double_t energy)
virtual THaVar * Find(const char *name) const
const void * GetValuePointer() const
virtual Int_t FillMap(THaDetMap *detmap, const char *detectorname)
A standard Hall C spectrometer apparatus.
virtual Int_t DecodeToHitList(const THaEvData &evdata, Bool_t suppress=kFALSE)
Populate the hitlist from the raw event data.
TClonesArray * fRawHitList
Definition THcHitList.h:51
void CreateMissReportParms(const char *prefix) const
void InitHitList(THaDetMap *detmap, const char *hitclass, Int_t maxhits, Int_t tdcref_cut=0, Int_t adcref_cut=0)
Save the electronics module to detector mapping and initialize a hit array of hits of class hitclass.
void MissReport(const char *name) const
Int_t fADC_RefTimeCut
Definition THcHitList.h:48
Int_t LoadParmValues(const DBRequest *list, const char *prefix="")
Retrieve parameter values from the parameter cache.
virtual Int_t CoarseProcessHits()
Double_t GetClMaxEnergyBlock()
Double_t GetEarray()
Double_t GetClSize()
Double_t GetClX()
virtual void Clear(Option_t *opt="")
virtual Int_t CoarseProcess(TClonesArray &tracks)
virtual EStatus Init(const TDatime &run_time)
virtual Int_t AccumulatePedestals(TClonesArray *rawhits, Int_t nexthit)
virtual void CalculatePedestals()
Float_t GetShEnergy(THaTrack *)
Int_t AccumulateStat(TClonesArray &tracks)
virtual Int_t ProcessHits(TClonesArray *rawhits, Int_t nexthit)
Double_t GetClY()
Int_t MatchCluster(THaTrack *, Double_t &, Double_t &)
One plane of shower blocks with side readout.
Double_t GetEplane()
virtual Int_t CoarseProcessHits()
virtual void Clear(Option_t *opt="")
Double_t GetEpos(Int_t i)
Double_t GetEneg(Int_t i)
virtual Int_t ProcessHits(TClonesArray *rawhits, Int_t nexthit)
Double_t GetEmean(Int_t i)
Double_t GetAnegP(Int_t i)
virtual Int_t AccumulatePedestals(TClonesArray *rawhits, Int_t nexthit)
virtual void CalculatePedestals()
TVector3 GetOrigin()
Generic segmented shower detector.
Definition THcShower.h:18
Double_t fEPRtrackNorm
Definition THcShower.h:238
Double_t * fPosAdcTimeWindowMax
Definition THcShower.h:199
Int_t * fShPosPedLimit
Definition THcShower.h:207
Int_t fdbg_clusters_cal
Definition THcShower.h:271
Int_t fNtracks
Definition THcShower.h:231
Double_t * fYPos
Definition THcShower.h:256
Double_t fXclustTrack
Definition THcShower.h:223
Double_t * fNegGain
Definition THcShower.h:213
Int_t MatchCluster(THaTrack *, Double_t &, Double_t &)
Double_t fvDelta
Definition THcShower.h:261
UInt_t fNTotBlocks
Definition THcShower.h:254
Double_t * fZPos
Definition THcShower.h:257
char ** fLayerNames
Definition THcShower.h:246
Double_t fSlop
Definition THcShower.h:259
Int_t fShMinPeds
Definition THcShower.h:210
Float_t YcorPr(Double_t y, Int_t side)
Definition THcShower.h:159
virtual Int_t End(THaRunBase *r=0)
void Setup(const char *name, const char *description)
Definition THcShower.cxx:67
Double_t fvXmax
Definition THcShower.h:264
Int_t fNblockHighEnergy
Definition THcShower.h:222
virtual EStatus Init(const TDatime &run_time)
Double_t fYclustArrayTrack
Definition THcShower.h:229
virtual Int_t ReadDatabase(const TDatime &date)
Double_t * fNegAdcTimeWindowMin
Definition THcShower.h:198
UInt_t fHasArray
Definition THcShower.h:249
Double_t fXTrackArray
Definition THcShower.h:228
Float_t GetShEnergy(THaTrack *, UInt_t NLayers, UInt_t L0=0)
Double_t fEtrack
Definition THcShower.h:235
Double_t * BlockThick
Definition THcShower.h:252
UInt_t fNTotLayers
Definition THcShower.h:248
void ClusterHits(THcShowerHitSet &HitSet, THcShowerClusterList *ClusterList)
void DeleteArrays()
Int_t fADCMode
Definition THcShower.h:189
Double_t fEtot
Definition THcShower.h:233
THcShowerPlane ** fPlanes
Definition THcShower.h:281
Double_t * fPosGain
Definition THcShower.h:212
Double_t fXTrack
Definition THcShower.h:224
Float_t Ycor(Double_t y)
Definition THcShower.h:139
Int_t * fPedNegDefault
Definition THcShower.h:202
Double_t fvXmin
Definition THcShower.h:263
virtual Int_t FineProcess(TClonesArray &tracks)
THcShowerArray * fArray
Definition THcShower.h:282
friend class THcShowerPlane
Definition THcShower.h:298
THcShowerClusterList * fClusterList
Definition THcShower.h:241
Double_t * fPosAdcTimeWindowMin
Definition THcShower.h:197
static const Int_t kADCDynamicPedestal
Definition THcShower.h:194
Double_t fDcor[2]
Definition THcShower.h:279
Double_t fYTrack
Definition THcShower.h:226
Int_t fdbg_raw_cal
Definition THcShower.h:268
Double_t fvYmin
Definition THcShower.h:265
virtual ~THcShower()
Int_t fNclust
Definition THcShower.h:218
Int_t * fPedPosDefault
Definition THcShower.h:201
Double_t fXclustArrayTrack
Definition THcShower.h:227
Double_t ** fXPos
Definition THcShower.h:255
Double_t fBcor
Definition THcShower.h:277
Double_t fYclustTrack
Definition THcShower.h:225
Double_t * fLayerZPos
Definition THcShower.h:250
Int_t fNhits
Definition THcShower.h:217
Int_t fdbg_tracks_cal
Definition THcShower.h:272
Double_t fAcor
Definition THcShower.h:276
Double_t fCcor[2]
Definition THcShower.h:278
Int_t fdbg_init_cal
Definition THcShower.h:273
Double_t fvYmax
Definition THcShower.h:266
UInt_t fNegCols
Definition THcShower.h:258
UInt_t * fNBlocks
Definition THcShower.h:253
Double_t fEtotNorm
Definition THcShower.h:234
Double_t fYTrackArray
Definition THcShower.h:230
Double_t fEtrackNorm
Definition THcShower.h:236
Int_t fvTest
Definition THcShower.h:260
Int_t fEvent
Definition THcShower.h:188
Double_t fEPRtrack
Definition THcShower.h:237
Double_t * fNegAdcTimeWindowMax
Definition THcShower.h:200
Int_t * fShNegPedLimit
Definition THcShower.h:208
Double_t GetNormETot()
virtual Int_t CoarseProcess(TClonesArray &tracks)
virtual void Clear(Option_t *opt="")
virtual Int_t Decode(const THaEvData &)
UInt_t fNLayers
Definition THcShower.h:247
Double_t fAdcTdcOffset
Definition THcShower.h:203
Int_t fAnalyzePedestals
Definition THcShower.h:205
Int_t fSizeClustArray
Definition THcShower.h:221
Int_t fNclustArrayTrack
Definition THcShower.h:220
Bool_t * fPresentP
Definition THcShower.h:187
friend class THcShowerArray
Definition THcShower.h:299
Int_t fdbg_decoded_cal
Definition THcShower.h:269
Double_t fETotTrackNorm
Definition THcShower.h:239
Int_t fNclustTrack
Definition THcShower.h:219
virtual Int_t DefineVariables(EMode mode=kDefine)
Int_t fdbg_sparsified_cal
Definition THcShower.h:270
const char * GetName() const override
const char * GetTitle() const override
virtual void Error(const char *method, const char *msgfmt,...) const
Double_t Z() const
void SetXYZ(Double_t x, Double_t y, Double_t z)
Double_t Y() const
Double_t X() const
Double_t y[n]
Double_t x[n]
TH1 * h
Double_t Min(Double_t a, Double_t b)
Double_t Abs(Double_t d)
Double_t Max(Double_t a, Double_t b)
STL namespace.
void tracks()