Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBCALShower_factory_JLAB.cc
Go to the documentation of this file.
1 // $Id: DBCALShower_factory_JLAB.cc $
2 //
3 // File: DBCALShower_factory_JLAB.cc
4 // Created: Mon Mar 18 09:42:29 EDT 2013
5 // Creator: Benedikt Zihlmann version 0.1
6 //
7 
8 #include "TMath.h"
10 
11 using namespace std;
12 
13 //------------------
14 // DBCALShower_factory_JLAB
15 //------------------
17 {
18 
19 }
20 
21 //------------------
22 // brun
23 //------------------
24 jerror_t DBCALShower_factory_JLAB::brun(JEventLoop *loop, int32_t runnumber)
25 {
26 
27  // at this point load parameters from data base
28 
29  return NOERROR;
30 }
31 
32 //------------------
33 // evnt
34 //------------------
35 jerror_t DBCALShower_factory_JLAB::evnt(JEventLoop *loop, uint64_t eventnumber)
36 {
37 
38  vector < const DBCALClump* > ClumpList;
39  loop->Get(ClumpList);
40 
41  // at this point ClumpList contains all information to build Clusters
42  // loop over all Clumps in ClumpList and generate Clusters
43 
44  int id = 0;
45  for (unsigned int i = 0; i < ClumpList.size(); i++){
46 
47  const DBCALClump* locClump = ClumpList[i];
48  DBCALShower *shower = new DBCALShower;
49 
50  shower->id = id++;
51  shower->E_raw = locClump->ClumpE[0];
52  shower->x = TMath::Cos(locClump->ClumpPhi[0])*65.; // HARD CODED VALUE!!!!
53  shower->y = TMath::Sin(locClump->ClumpPhi[0])*65.; // HARD CODED VALUE!!!!
54  shower->z = locClump->ClumpPos[0] + 17.; // HARD CODED VALUE!!!!
55  shower->t = locClump->ClumpMT[0];
56  shower->N_cell = locClump->HitsU.size()+locClump->HitsD.size();
57 
58  // shower->xErr = 0.5; // HARD CODED VALUE!!!!
59  // shower->yErr = 0.5; // HARD CODED VALUE!!!!
60  // shower->zErr = 2.5; // HARD CODED VALUE!!!!
61  // shower->tErr = 0.2; // HARD CODED VALUE!!!!
62 
63 
64  shower->E = locClump->ClumpE[0]; // NO CALIBRATION DONE!!!!!
65 
66  //copy xyz errors into covariance matrix
67  // shower->xyzCovariance.ResizeTo(3,3);
68  // shower->xyzCovariance[0][0] = shower->xErr*shower->xErr;
69  // shower->xyzCovariance[1][1] = shower->yErr*shower->yErr;
70  // shower->xyzCovariance[2][2] = shower->zErr*shower->zErr;
71 
72  // add BCAL Hits as associated objects.
73  for(unsigned int j=0; j<locClump->HitsU.size(); j++){
74  shower->AddAssociatedObject(locClump->HitsU[j]);
75  }
76  for(unsigned int j=0; j<locClump->HitsD.size(); j++){
77  shower->AddAssociatedObject(locClump->HitsD[j]);
78  }
79 
80  _data.push_back(shower);
81  }
82 
83  return NOERROR;
84 }
85 
86 
vector< float > ClumpPhi
Definition: DBCALClump.h:46
jerror_t brun(JEventLoop *loop, int32_t runnumber)
vector< float > ClumpPos
Definition: DBCALClump.h:45
jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
Invoked via JEventProcessor virtual method.
vector< float > ClumpE
Definition: DBCALClump.h:43
vector< const DBCALHit * > HitsU
Definition: DBCALClump.h:30
vector< float > ClumpMT
Definition: DBCALClump.h:44
vector< const DBCALHit * > HitsD
Definition: DBCALClump.h:31
float E_raw
Definition: DBCALShower.h:18