31 includeUnmatchedHits_(include_unmatched_hits),
37 for(
int i=0;
i<161;
i++)
41 for(
unsigned int ii=0;
ii<calibLines_.size();
ii++)
44 if(calibLines_[
ii][0]==
"TDC")
46 if(calibLines_[
ii].
size()==4)
48 int channel=atoi(calibLines_[
ii][1].c_str());
49 tdc_ped[channel]=atof(calibLines_[
ii][2].c_str());
56 "Wrong TDC configuration format : expected 3 parameters, got "<<calibLines_[
ii].size()-1;
61 if(calibLines_[
ii][0]==
"WC")
63 if(calibLines_[
ii].
size()==6)
65 int plane=atoi(calibLines_[
ii][1].c_str());
66 wc_[plane].
b0=atof(calibLines_[
ii][2].c_str());
67 wc_[plane].
b1=atof(calibLines_[
ii][3].c_str());
68 wc_[plane].
mean=atof(calibLines_[
ii][4].c_str());
69 wc_[plane].
sigma=atof(calibLines_[
ii][5].c_str());
76 "Wrong Wire Chamber configuration format : expected 5 parameters, got "<<calibLines_[
ii].size()-1;
86 std::vector<Hit> hits;
115 if (raw.
size()<3*8) {
116 throw cms::Exception(
"Missing Data") <<
"No data in the TDC block";
119 const unsigned int* hitbase=0;
120 unsigned int totalhits=0;
125 hitbase=(
const unsigned int*)(qdctdc);
134 hitbase=&(tdc->
hits[0]);
138 for (
unsigned int i=0;
i<totalhits;
i++) {
140 h.
channel=(hitbase[
i]&0x7FC00000)>>22;
148 for (
int i=0;
i<32;
i++) v775[
i]=-1;
151 hitbase=(
const unsigned int*)(qdctdc);
155 totalhits=(qdctdc->
n_tdc_hits&0xFFFF0000)>>16;
156 for (
unsigned int i=0;
i<totalhits;
i++) {
159 h.
channel=129+((hitbase[
i]&0x3F0000)>>16);
163 v775[(h.
channel-129)] = (hitbase[
i]&0xFFF);
172 std::vector<Hit>::const_iterator
j;
173 double trigger_time=0;
174 double ttc_l1a_time=0;
175 double laser_flash=0;
182 std::vector<double> m1hits, m2hits, m3hits, s1hits, s2hits, s3hits, s4hits,
183 bh1hits, bh2hits, bh3hits, bh4hits,beam_coinc;
185 for (j=hits.begin(); j!=hits.end(); j++) {
186 switch (j->channel) {
211 timing.
setTimes(trigger_time,ttc_l1a_time,laser_flash,qie_phase,TOF1S_time,TOF1J_time,TOF2S_time,TOF2J_time);
212 timing.
setHits (m1hits,m2hits,m3hits,s1hits,s2hits,s3hits,s4hits,bh1hits,bh2hits,bh3hits,bh4hits,beam_coinc);
272 const int MAX_HITS=100;
273 float hits1[MAX_HITS], hits2[MAX_HITS], hitsA[MAX_HITS];
274 int n1,n2,nA,chan1,chan2,chanA;
276 std::vector<double>
x;
278 for (
int plane=0; plane<
PLANECOUNT; plane++) {
281 std::vector<double> plane_hits;
292 for (std::vector<Hit>::const_iterator
j=hits.begin();
j!=hits.end();
j++) {
293 if (
j->channel==chan1 && n1<MAX_HITS) {
296 if (
j->channel==chan2 && n2<MAX_HITS) {
299 if (
j->channel==chanA && nA<MAX_HITS) {
304 if (n1!=0 && n2!=0 &&
dumpObs_!=0) {
305 fprintf(
dumpObs_,
"%d,%f,%f,%f,%f\n",plane,hits1[0],hits2[0],hitsA[0],hitsA[1]);
310 for (
int ii=0;
ii<n1;
ii++) {
311 int jmin=-1, lmin=-1;
313 for (
int jj=0;
jj<n2;
jj++) {
314 for (
int ll=0; ll<nA; ll++) {
315 float dsum=fabs(
wc_[plane].
mean - hits1[
ii] - hits2[
jj] + 2.0*hitsA[ll]);
316 if(dsum<(
N_SIGMA*
wc_[plane].sigma) && dsum<dsumMin){
324 hit_time =
wc_[plane].
b0 +
325 wc_[plane].
b1 * (hits1[
ii]-hits2[jmin]);
328 plane_hits.push_back(-hit_time);
330 plane_hits.push_back(hit_time);
339 for (
int ii=0;
ii<n1;
ii++) {
340 if (hits1[
ii]<-99990)
continue;
341 for (
int jj=0;
jj<n2;
jj++) {
342 if (hits2[
jj]<-99990)
continue;
343 hit_time =
wc_[plane].
b0 +
347 plane_hits.push_back(-hit_time);
349 plane_hits.push_back(hit_time);
354 if ((plane%2)==0) x=plane_hits;
356 char chamber=
'A'+plane/2;
static const int lcBeamCoincidence
void setChamberHits(char chamberch, const std::vector< double > &xvec, const std::vector< double > &yvec)
void reconstructTiming(const std::vector< Hit > &hits, HcalTBTiming &timing) const
static const int lcBeamHalo4
void unpackHits(const FEDRawData &raw, std::vector< Hit > &hits, HcalTBTiming &timing) const
static const int lcTTCL1ATime
static const int lcScint4
static const int lcScint3
size_t size() const
Lenght of the data buffer in bytes.
static const int lcBeamHalo2
static const int lcLaserFlash
static const int lcScint1
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void setCalib(const std::vector< std::vector< std::string > > &calibLines_)
static const int lcBeamHalo1
static const int lcTriggerTime
static const int lcQIEPhase
bool includeUnmatchedHits_
void unpack(const FEDRawData &raw, HcalTBEventPosition &pos, HcalTBTiming &timing) const
void reconstructWC(const std::vector< Hit > &hits, HcalTBEventPosition &pos) const
static const double N_SIGMA
static const int lcBeamHalo3
void setTimes(const double trigger_time, const double ttc_l1a_time, const double laser_flash, const double qie_phase, const double TOF1S_time, const double TOF1J_time, const double TOF2S_time, const double TOF2J_time)
static const int PLANECOUNT
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static const double TDC_OFFSET_CONSTANT
void setHits(const std::vector< double > &m1hits, const std::vector< double > &m2hits, const std::vector< double > &m3hits, const std::vector< double > &s1hits, const std::vector< double > &s2hits, const std::vector< double > &s3hits, const std::vector< double > &s4hits, const std::vector< double > &bh1hits, const std::vector< double > &bh2hits, const std::vector< double > &bh3hits, const std::vector< double > &bh4hits, const std::vector< double > &beamCoincidenceHits)
static const int WC_CHANNELIDS[PLANECOUNT *3]
tuple size
Write out results.
struct hcaltb::HcalTBTDCUnpacker::WireChamberRecoData wc_[PLANECOUNT]
static const int lcScint2