#include <CalHit.h>
Inheritance diagram for calhit::CalHit:

Public Member Functions | |
| CalHit (const char *version) | |
| virtual | ~CalHit () |
| jobc::Result | Reco (edm::EventHandle &evt) |
| void | Update (const cfg::Config &) |
Private Member Functions | |
| void | RoughReco (edm::EventHandle &evt) |
Private Attributes | |
| calib::Calibrator * | fCal |
| ptr to Calibrator instance | |
| geo::Geometry * | fGeo |
| ptr to Geometry instance | |
| std::string | fRawDigitInputFolder |
| folder name for RawDigit input | |
| std::string | fCellHitOutputFolder |
| folder name for Cellhit output | |
| std::string | fRecoHitOutputFolder |
| folder name for RecoHit output | |
| int | fRunRoughReco |
| whether to do the rough reco | |
|
|
Definition at line 18 of file CalHit.cxx. References jobc::Module::SetCfgVersion(). 00018 : 00019 jobc::Module("CalHit"), 00020 fCal(0), 00021 fGeo(0), 00022 fRawDigitInputFolder("."), 00023 fCellHitOutputFolder("Hits"), 00024 fRecoHitOutputFolder("Rough"), 00025 fRunRoughReco(0) 00026 { 00027 this->SetCfgVersion(version); 00028 }
|
|
|
Definition at line 31 of file CalHit.cxx. 00031 { }
|
|
|
Reimplemented from jobc::Module. Definition at line 45 of file CalHit.cxx. References edm::EventHandle::Cal(), fCal, fCellHitOutputFolder, fGeo, fRawDigitInputFolder, fRunRoughReco, util::EDMUtils::GetCalibrator(), util::EDMUtils::GetGeometry(), calib::Calibrator::MakeCellHit(), edm::EventHandle::Raw(), and RoughReco(). 00046 {
00047
00048 // Load the RawDigit list
00049 std::vector<const rawdata::RawDigit*> digitlist(0);
00050 try {
00051 evt.Raw().Get(fRawDigitInputFolder.c_str(),digitlist);
00052 }
00053 catch (edm::Exception e) {
00054 return jobc::kFailed;
00055 }
00056
00057 // Get a Calibrator instance for this event
00058 if (!fCal) fCal = &util::EDMUtils::GetCalibrator(evt);
00059
00060 // Get a Geometry instance for this event, if needed (RoughReco)
00061 if (fRunRoughReco&&!fGeo) fGeo = &util::EDMUtils::GetGeometry(evt);
00062
00063 // Make a CellHit for every RawDigit and write it out
00064 UInt_t Ndigits = digitlist.size();
00065
00066 if (Ndigits) {
00067
00068 // Make the output folder
00069 if(evt.Cal().GetFolder(fCellHitOutputFolder.c_str()) == 0)
00070 evt.Cal().MakeFolder(fCellHitOutputFolder.c_str());
00071
00072 // Make the hits and write them out
00073 for (UInt_t iD=0;iD<Ndigits;iD++) {
00074
00075 CellHit curr_cellhit;
00076 fCal->MakeCellHit(digitlist[iD],&curr_cellhit);
00077
00078 evt.Cal().Put(curr_cellhit,fCellHitOutputFolder.c_str());
00079
00080 }
00081
00082 // Should we make rough RecoHits based on neighboring planes' hits?
00083 if (fRunRoughReco) RoughReco(evt);
00084
00085 }
00086
00087
00088 return jobc::kPassed;
00089
00090 }
|
|
|
Definition at line 101 of file CalHit.cxx. References edm::EventHandle::Cal(), recobase::CellHit::Cell(), fCal, fCellHitOutputFolder, fGeo, fRecoHitOutputFolder, calib::Calibrator::MakeRecoHit(), geo::Geometry::NextPlaneInView(), geo::Geometry::NextPlaneOtherView(), recobase::CellHit::PECorr(), geo::Geometry::Plane(), recobase::CellHit::Plane(), edm::EventHandle::Reco(), and recobase::CellHit::View(). Referenced by Reco(). 00101 {
00102
00103 // Load the CellHit list (just made)
00104 std::vector<const recobase::CellHit*> cellhitlist(0);
00105 evt.Cal().Get(fCellHitOutputFolder.c_str(),cellhitlist);
00106
00107 // Make the output folder
00108 if(evt.Reco().GetFolder(fRecoHitOutputFolder.c_str()) == 0)
00109 evt.Reco().MakeFolder(fRecoHitOutputFolder.c_str());
00110
00111 // to handle mean positions
00112 std::map<unsigned int, std::pair<double, double> > planeMean;
00113 planeMean.clear();
00114
00115 // Get Q-weighted mean positions in each plane
00116 UInt_t Ncellhits = cellhitlist.size();
00117
00118 for (UInt_t iC=0;iC<Ncellhits;iC++) {
00119 const CellHit *cellhit = cellhitlist[iC];
00120 UInt_t plane = cellhit->Plane();
00121 UInt_t cell = cellhit->Cell();
00122
00123 Double_t xyz[3];
00124 fGeo->Plane(plane).Cell(cell).GetCenter(xyz);
00125 Double_t viewpos = 0;
00126 if (cellhit->View()==geo::kX) viewpos = xyz[0];
00127 else if (cellhit->View()==geo::kY) viewpos = xyz[1];
00128
00129 if (planeMean.find(plane)==planeMean.end()) {
00130 // init
00131 planeMean[plane].first = 0;
00132 planeMean[plane].second = 0;
00133 }
00134 planeMean[plane].first += cellhit->PECorr();
00135 planeMean[plane].second += cellhit->PECorr()*viewpos;
00136 }
00137
00138 // Determine ortho pos for each CellHit, and make the corresponding RecoHit
00139 for (UInt_t iC=0;iC<Ncellhits;iC++) {
00140 const CellHit *cellhit = cellhitlist[iC];
00141 UInt_t plane = cellhit->Plane();
00142
00143 // first, just accumulate existing plane numbers in other view,
00144 // within 3 planes of hit planes
00145 // use a fixed array so we can skip specific elements later if necessary
00146 unsigned int planes[6]={9999,9999,9999,9999,9999,9999};
00147
00148 // attempt to walk back three planes.
00149 unsigned int pl=fGeo->NextPlaneOtherView(plane,-1);
00150 if (pl!=geo::kPLANE_NOT_FOUND) {
00151 planes[0]=pl;
00152 pl=fGeo->NextPlaneInView(pl,-1);// have to protect against Plane
00153 // not found, since otherwise the second
00154 // try will give the end of the detector
00155 if (pl!=geo::kPLANE_NOT_FOUND) {
00156 planes[1]=pl;
00157 pl=fGeo->NextPlaneInView(pl,-1);
00158 if (pl!=geo::kPLANE_NOT_FOUND) planes[2]=pl;
00159 }
00160 }
00161
00162 // and forward three planes
00163 pl=fGeo->NextPlaneOtherView(plane,1);
00164 if (pl!=geo::kPLANE_NOT_FOUND) {
00165 planes[3]=pl;
00166 pl=fGeo->NextPlaneInView(pl,1);// have to protect against Plane
00167 // not found, since otherwise the second
00168 // try will give plane 1 (I think)
00169 if (pl!=geo::kPLANE_NOT_FOUND) {
00170 planes[4]=pl;
00171 pl=fGeo->NextPlaneInView(pl,1);
00172 if (pl!=geo::kPLANE_NOT_FOUND) planes[5]=pl;
00173 }
00174 }
00175
00176 double sPh=0; // sum of pulseheight and (ph-weighted) position
00177 double sTPos=0;
00178
00179 for (unsigned int ip=0; ip<6; ip++) {
00180 // only uses the -3 and +3 planes if we don't already have signal
00181 // from +/-1 and 2.
00182 if (sPh>0 && (ip==2 || ip==5) ) continue;
00183
00184 unsigned int planeno=planes[ip];
00185 if (planeMean.find(planeno)!=planeMean.end()) {//9999 won't be found...
00186 sPh+=planeMean[planeno].first;
00187 sTPos+=planeMean[planeno].second;
00188 }
00189 }
00190
00191 // use middle of cell if position not calculable
00192 Double_t w = 0;
00193 if (sPh>0) w = sTPos/sPh;
00194
00195 // Okay, got the ortho position (w). Make the RecoHit.
00196 RecoHit recohit;
00197 fCal->MakeRecoHit(cellhit,&recohit,w);
00198 evt.Reco().Put(recohit,fRecoHitOutputFolder.c_str());
00199
00200 } // hit loop
00201
00202 }
|
|
|
Implements cfg::Observer. Definition at line 35 of file CalHit.cxx. References fCellHitOutputFolder, fRawDigitInputFolder, fRecoHitOutputFolder, and fRunRoughReco. 00036 {
00037 c("RawDigitInputFolder").Get(fRawDigitInputFolder);
00038 c("CellHitOutputFolder").Get(fCellHitOutputFolder);
00039 c("RecoHitOutputFolder").Get(fRecoHitOutputFolder);
00040 c("RunRoughReco") .Get(fRunRoughReco);
00041 }
|
|
|
ptr to Calibrator instance
Definition at line 31 of file CalHit.h. Referenced by Reco(), and RoughReco(). |
|
|
folder name for Cellhit output
Definition at line 34 of file CalHit.h. Referenced by Reco(), RoughReco(), and Update(). |
|
|
ptr to Geometry instance
Definition at line 32 of file CalHit.h. Referenced by Reco(), and RoughReco(). |
|
|
folder name for RawDigit input
|
|
|
folder name for RecoHit output
Definition at line 35 of file CalHit.h. Referenced by RoughReco(), and Update(). |
|
|
whether to do the rough reco
|
1.3.9.1