#include <CellHitMerge.h>
Inheritance diagram for cellhitmerge::CellHitMerge:

Public Member Functions | |
| CellHitMerge (const char *version) | |
| void | Update (const cfg::Config &c) |
| ~CellHitMerge () | |
| jobc::Result | Reco (edm::EventHandle &evt) |
| jobc::Result | Ana (const edm::EventHandle &evt) |
Private Attributes | |
| int | nprinted |
| TH1D * | delTMerged |
| TH1D * | delPHMerged |
| TH2D * | delPhvdelT |
| TH1D * | celldiff |
| TH2D * | delPhvPh |
| TH2D * | phvph |
| bool | fSkipMe |
| int | nevtmerged |
| int | maxdiffcells |
| int | npruned |
| int | maxpruned |
|
|
Definition at line 31 of file CellHitMerge.cxx. References celldiff, delPHMerged, delPhvdelT, delPhvPh, delTMerged, phvph, and jobc::Module::SetCfgVersion(). 00031 : 00032 jobc::Module("cellhitmerge::CellHitMerge"), // Required! 00033 nprinted(0), 00034 fSkipMe(false), 00035 nevtmerged(0), 00036 maxdiffcells(0), 00037 npruned(0), 00038 maxpruned(0) 00039 { 00040 delTMerged = new TH1D("delTMerged","",200,0,2000); 00041 delPHMerged = new TH1D("delPHMerged","",300,-1500,1500); 00042 delPhvdelT = new TH2D("delPhvdelT","",200,0,2000,300,-1500,1500); 00043 celldiff = new TH1D("celldiff","",31,-0.5,30.5); 00044 delPhvPh = new TH2D("delPhvPh","",150,0,1500,300,-1500,1500); 00045 phvph = new TH2D("phvph","",150,0,1500,150,0,1500); 00046 00047 this->SetCfgVersion(version); // Required! 00048 }
|
|
|
Definition at line 70 of file CellHitMerge.cxx. References maxdiffcells, maxpruned, nevtmerged, and npruned. 00071 {
00072 cout<<"Number of events that got pruned: "<<npruned<<" max pruning: "<<maxpruned<<" cells"<<endl;
00073 cout<<"Number of events that got merged or pruned: "<<nevtmerged<<" max difference: "<<maxdiffcells<<" cells"<<endl;
00074 }
|
|
|
Reimplemented from jobc::Module. Definition at line 188 of file CellHitMerge.cxx. References edm::EventHandle::Cal(), celldiff, maxdiffcells, nevtmerged, and nprinted. 00189 {
00190 //======================================================================
00191 // Called for every event. "Ana" implies that you are looking at the
00192 // event, but not altering it.
00193 //======================================================================
00194
00195
00196 std::vector<const recobase::CellHit*> hitlist(0);
00197 try{ evt.Cal().Get("Hits",hitlist); }
00198 catch(edm::Exception e){
00199 cerr<<"Couldn't find the Original hit list"<<endl;
00200 return jobc::kFailed;
00201 }
00202
00203 std::vector<const recobase::CellHit*> mergehitlist(0);
00204 try{ evt.Cal().Get("./MergeHits",mergehitlist); }
00205 catch(edm::Exception e){
00206 cerr<<"Couldn't find the merged hit list"<<endl;
00207 return jobc::kFailed;
00208 }
00209
00210
00211 if(hitlist.size()!=mergehitlist.size()){
00212 nevtmerged++;
00213 int diff = hitlist.size()-mergehitlist.size();
00214 if(diff<0){
00215 diff = mergehitlist.size()-hitlist.size();
00216 }
00217 if(diff>maxdiffcells){
00218 maxdiffcells=diff;
00219 }
00220 celldiff->Fill(diff);
00221 // cout<<"Hit List Sizes differ. Printing both. Size of original: "
00222 // <<hitlist.size()<<" Size of Merged "<<mergehitlist.size()<<" Diff: "<<diff<<endl;
00223 }
00224 else{
00225 celldiff->Fill(0);
00226 return jobc::kPassed;
00227 }
00228
00229 nprinted++;
00230 if(nprinted<11){
00231 cout<<"Will print 10 events that got merged. On number: "<<nprinted<<endl;
00232 cout<<"Printing Original Hits: "<<hitlist.size()<<endl;
00233 for(unsigned int i=0;i<hitlist.size();i++){
00234 cout<<"** Printing Original CellHit index "<<i<<" **"<<endl;
00235 hitlist[i]->Print("");
00236 cout<<"*************"<<endl;
00237 }
00238
00239 cout<<"Printing Merged Hits: "<<mergehitlist.size()<<endl;
00240 for(unsigned int i=0;i<mergehitlist.size();i++){
00241 cout<<"** Printing Merged CellHit index "<<i<<" **"<<endl;
00242 mergehitlist[i]->Print("");
00243 cout<<"*************"<<endl;
00244 }
00245 }
00246 return jobc::kPassed; // kFailed if you want to fail the event
00247
00248 }
|
|
|
Reimplemented from jobc::Module. Definition at line 78 of file CellHitMerge.cxx. References rawdata::RawDigit::ADC(), edm::EventHandle::Cal(), recobase::CellHit::Cell(), edm::EventHandle::DAQ(), delPHMerged, delPhvdelT, delPhvPh, delTMerged, geo::Geometry::Instance(), maxpruned, geo::Geometry::NPlanes(), nprinted, npruned, phvph, geo::Geometry::Plane(), recobase::CellHit::Plane(), and rawdata::RawDigit::TDC(). 00079 {
00080 if(fSkipMe) return jobc::kPassed;
00081
00082 //get the list of CellHits
00083 std::vector<const recobase::CellHit*> hitlist(0);
00084 try{ evt.Cal().Get("Hits",hitlist); }
00085 catch(edm::Exception e){
00086 cerr<<"Couldn't find the CellHit list"<<endl;
00087 return jobc::kFailed;
00088 }
00089
00090 //make a new hitlist to hold the pruned/merged hits
00091 std::vector<recobase::CellHit*> newhitlist;
00092
00093 //now get a header
00094 std::vector<const hdr::Header*> head(0);
00095 try{ evt.DAQ().Get(".",head); }
00096 catch(edm::Exception e){
00097 cerr<<"Couldn't get a head"<<endl;
00098 return false;
00099 }
00100 geo::Geometry& geom = geo::Geometry::Instance(1,head[0]->DetectorID());
00101 int DETLASTPLANE = (int) geom.NPlanes();
00102 //now loop over CellHits in the list and look for crazies/duplicates
00103 std::vector<const recobase::CellHit*>::iterator chit=hitlist.begin();
00104 bool pruned=false;
00105 int ncellpruned = 0;
00106 while(chit!=hitlist.end()){
00107 const CellHit* stp = *chit;
00108 // cout<<"Printing cell hit in CellHitMerge"<<endl;
00109 // stp->Print();
00110 // if this cell has a plane number beyond the bounds of the detector
00111 //erase it from the list
00112 if(stp->Plane()<0 || stp->Plane()>DETLASTPLANE){
00113 hitlist.erase(chit);
00114 cerr<<" CellHitMerge:: found plane crazy "<<stp->Plane()<<" strip "<<stp->Cell()<<endl;
00115 pruned=true;
00116 ncellpruned++;
00117 continue;
00118 }
00119 //if this cell has a cell number beyond the bounds of this plane
00120 //erase it from the list
00121 int PLANELASTCELL = (int) geom.Plane(stp->Plane()).Ncells();
00122 if(stp->Cell()<0 || stp->Cell()>PLANELASTCELL){
00123 hitlist.erase(chit);
00124 cerr<<" CellHitMerge:: found strip crazy "<< stp->Cell()<<" plane "<<stp->Plane()<< endl;
00125 pruned=true;
00126 ncellpruned++;
00127 continue;
00128 }
00129
00130 //make a new CellHit that we can modify if need be
00131 CellHit *newstp = new CellHit(*stp);
00132
00133 //now check if this cell is duplicated in the list
00134 std::vector<const recobase::CellHit*>::iterator dhit=chit;
00135 dhit++;
00136 while(dhit!=hitlist.end()){
00137 const CellHit* stp2 = *dhit;
00138 if(newstp->Plane()==stp2->Plane() && newstp->Cell()==stp2->Cell()){
00139 if(nprinted<11){
00140 // cerr<<"Merging Cells: "<<newstp->Plane()<<" "<<newstp->Cell()<<endl;
00141 }
00142 unsigned short tdc1, tdc2;
00143 newstp->TDC(tdc1);
00144 stp2->TDC(tdc2);
00145 float tdiff = fabs(1.*tdc1-1.*tdc2);
00146 delTMerged->Fill(tdiff);
00147
00148 unsigned short adc1,adc2;
00149 newstp->ADC(adc1);
00150 stp2->ADC(adc2);
00151 float phdiff = 1.*adc1-1.*adc2;
00152 unsigned short maxph=adc1;
00153 if(adc2>adc1) maxph=adc2;
00154 delPHMerged->Fill(phdiff);
00155 delPhvdelT->Fill(tdiff,phdiff);
00156 delPhvPh->Fill(maxph,phdiff);
00157 phvph->Fill(adc1,adc2);
00158 newstp->Merge(stp2);
00159 hitlist.erase(dhit);
00160 continue;
00161 }
00162 // cout<<"about to put a CellHit in the newhitlist"<<endl;
00163 // newstp->Print();
00164 dhit++;
00165 }
00166 newhitlist.push_back(newstp);
00167 chit++;
00168 }
00169 if(pruned){
00170 npruned++;
00171 if(ncellpruned>maxpruned){
00172 maxpruned=ncellpruned;
00173 }
00174 }
00175
00176 if(evt.Cal().GetFolder("./MergeHits")==0){
00177 evt.Cal().MakeFolder("./MergeHits");
00178 }
00179
00180 // cout<<"about to put vector of new hits in file "<<newhitlist.size()<<endl;
00181 evt.Cal().PutVector(newhitlist,"./MergeHits");
00182
00183 return jobc::kPassed; // kFailed if you want to fail the event
00184 }
|
|
|
Implements cfg::Observer. Definition at line 52 of file CellHitMerge.cxx. References fSkipMe. 00053 {
00054
00055
00056 //maybe we wont want to do this step sometimes
00057 int domergestep;
00058 c("DoMergeStep").Get(domergestep);
00059 if(domergestep==0){
00060 fSkipMe=true;
00061 }
00062 else{
00063 fSkipMe=false;
00064 }
00065
00066 }
|
|
|
Definition at line 43 of file CellHitMerge.h. Referenced by Ana(), and CellHitMerge(). |
|
|
Definition at line 41 of file CellHitMerge.h. Referenced by CellHitMerge(), and Reco(). |
|
|
Definition at line 42 of file CellHitMerge.h. Referenced by CellHitMerge(), and Reco(). |
|
|
Definition at line 44 of file CellHitMerge.h. Referenced by CellHitMerge(), and Reco(). |
|
|
Definition at line 40 of file CellHitMerge.h. Referenced by CellHitMerge(), and Reco(). |
|
|
Definition at line 47 of file CellHitMerge.h. Referenced by Update(). |
|
|
Definition at line 49 of file CellHitMerge.h. Referenced by Ana(), and ~CellHitMerge(). |
|
|
Definition at line 51 of file CellHitMerge.h. Referenced by Reco(), and ~CellHitMerge(). |
|
|
Definition at line 48 of file CellHitMerge.h. Referenced by Ana(), and ~CellHitMerge(). |
|
|
Definition at line 39 of file CellHitMerge.h. |
|
|
Definition at line 50 of file CellHitMerge.h. Referenced by Reco(), and ~CellHitMerge(). |
|
|
Definition at line 45 of file CellHitMerge.h. Referenced by CellHitMerge(), and Reco(). |
1.3.9.1