CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalLaserAnalyzerYousi Class Reference

#include <CalibCalorimetry/EcalLaserAnalyzerYousi/src/EcalLaserAnalyzerYousi.cc>

Inheritance diagram for EcalLaserAnalyzerYousi:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 EcalLaserAnalyzerYousi (const edm::ParameterSet &)
 
 ~EcalLaserAnalyzerYousi () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

TH2F * APD
 
TH1F * APD_LM [9]
 
TH2F * APD_RMS
 
TH2F * APDPN
 
TH2F * APDPN_C
 
TH2F * APDPN_J
 
TH2F * APDPN_J_H [2]
 
TH2F * APDPN_J_LM [9]
 
TH1F * APDPN_LM [9]
 
TH2F * APDPN_RMS
 
TH1F * C_APD [1700]
 
TH1F * C_APDPN [1700]
 
TH2F * C_APDPN_J [1700]
 
TH1F * C_J [1700]
 
TH1F * C_PN [1700]
 
TNtuple * C_Tree [1700]
 
TH2F * Count
 
const std::string digiProducer_
 
TFile * fAPD
 
TH1F * FitHist
 
TFile * fPN
 
TFile * fROOT
 
const std::string hitCollection_
 
const std::string hitProducer_
 
const edm::EDGetTokenT< EBUncalibratedRecHitCollectionhitToken_
 
const std::string outFileName_
 
TH1F * peakAPD [2]
 
TH1F * peakAPDPN [2]
 
TH2F * PN
 
const std::string PNdigiCollection_
 
const edm::EDGetTokenT< EcalPnDiodeDigiCollectionpnDigiToken_
 
const edm::EDGetTokenT< EcalRawDataCollectionrawDataToken_
 
const std::string Run_
 
const std::string SM_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 52 of file EcalLaserAnalyzerYousi.cc.

Constructor & Destructor Documentation

◆ EcalLaserAnalyzerYousi()

EcalLaserAnalyzerYousi::EcalLaserAnalyzerYousi ( const edm::ParameterSet iConfig)
explicit

Definition at line 122 of file EcalLaserAnalyzerYousi.cc.

123  : hitCollection_(iConfig.getUntrackedParameter<std::string>("hitCollection")),
124  hitProducer_(iConfig.getUntrackedParameter<std::string>("hitProducer")),
125  outFileName_(iConfig.getUntrackedParameter<std::string>("outFileName")),
126  SM_(iConfig.getUntrackedParameter<std::string>("SM")),
127  Run_(iConfig.getUntrackedParameter<std::string>("Run")),
128  digiProducer_(iConfig.getUntrackedParameter<std::string>("digiProducer")),
129  PNdigiCollection_(iConfig.getUntrackedParameter<std::string>("PNdigiCollection")),
130  rawDataToken_(consumes<EcalRawDataCollection>(edm::InputTag(digiProducer_))),
131  hitToken_(consumes<EBUncalibratedRecHitCollection>(edm::InputTag(hitProducer_, hitCollection_))),
132  pnDigiToken_(consumes<EcalPnDiodeDigiCollection>(edm::InputTag(digiProducer_, PNdigiCollection_))) {
133  //now do what ever initialization is needed
134  //get the PN and AB file names
135  //get the output file names, digi producers, etc
136 
137  // PNFileName_ = iConfig.getUntrackedParameter<std::string>("PNFileName");
138  // ABFileName_ = iConfig.getUntrackedParameter<std::string>("ABFileName");
139 }
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDigiToken_
T getUntrackedParameter(std::string const &, T const &) const
const std::string PNdigiCollection_
const std::string hitCollection_
const edm::EDGetTokenT< EBUncalibratedRecHitCollection > hitToken_

◆ ~EcalLaserAnalyzerYousi()

EcalLaserAnalyzerYousi::~EcalLaserAnalyzerYousi ( )
overridedefault

Member Function Documentation

◆ analyze()

void EcalLaserAnalyzerYousi::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 146 of file EcalLaserAnalyzerYousi.cc.

References gpuClustering::adc, APD_LM, APDPN_C, APDPN_J, APDPN_J_H, APDPN_J_LM, APDPN_LM, edm::SortedCollection< T, SORT >::begin(), C_APD, C_APDPN, C_APDPN_J, C_J, C_PN, C_Tree, RecoSummaryTask_cfi::Chi2, CN, FitHist, hitCollection_, hfClusterShapes_cfi::hits, hitToken_, iEvent, edm::HandleBase::isValid(), dqmiolumiharvest::j, dqmdumpme::k, SiStripPI::max, peakAPD, peakAPDPN, QIE10Task_cfi::ped, pnDigiToken_, rawDataToken_, ecalGpuTask_cfi::sample, EcalDCCHeaderBlock::EcalDCCEventSettings::wavelength, and z.

146  {
147  using namespace edm;
148 
149  // if ( fPN->IsOpen() ) { edm::LogInfo("EcalLaserAnalyzerYousi") <<"fPN is open in analyze OKAAAAAAAAYYY \n\n"; }
150 
151  const edm::Handle<EcalRawDataCollection> &DCCHeaders = iEvent.getHandle(rawDataToken_);
152 
153  EcalDCCHeaderBlock::EcalDCCEventSettings settings = DCCHeaders->begin()->getEventSettings();
154 
155  int wavelength = settings.wavelength;
156 
157  // std::cout<<"wavelength: "<<wavelength<<"\n\n";
158 
159  if (wavelength != 0) {
160  return;
161  } //only process blue laser
162 
164 
165  if (!hits.isValid()) {
166  edm::LogError("EcalLaserAnalyzerYousi")
167  << "Cannot get product: EBRecHitCollection from: " << hitCollection_ << " - returning.\n\n";
168  return;
169  }
170 
171  const edm::Handle<EcalPnDiodeDigiCollection> &pndigis = iEvent.getHandle(pnDigiToken_);
172  if (!pndigis.isValid()) {
173  edm::LogError("EcalLaserAnalyzerYousi") << "Cannot get product: EBdigiCollection from: getHandle - returning.\n\n";
174  return;
175  }
176 
177  Float_t PN_amp[5];
178 
179  //do some averaging over each pair of PNs
180  for (int j = 0; j < 5; ++j) {
181  PN_amp[j] = 0;
182  for (int z = 0; z < 2; ++z) {
183  FitHist->Reset();
184  TF1 peakFit("peakFit", "[0] +[1]*x +[2]*x^2", 30, 50);
185  TF1 pedFit("pedFit", "[0]", 0, 5);
186 
187  for (int k = 0; k < 50; k++) {
188  FitHist->SetBinContent(k, (*pndigis)[j + z * 5].sample(k).adc());
189  }
190  pedFit.SetParameter(0, 750);
191  FitHist->Fit(&pedFit, "RQI");
192  Float_t ped = pedFit.GetParameter(0);
193 
194  Int_t maxbin = FitHist->GetMaximumBin();
195  peakFit.SetRange(FitHist->GetBinCenter(maxbin) - 4 * FitHist->GetBinWidth(maxbin),
196  FitHist->GetBinCenter(maxbin) + 4 * FitHist->GetBinWidth(maxbin));
197  peakFit.SetParameters(750, 4, -.05);
198  FitHist->Fit(&peakFit, "RQI");
199  Float_t max = peakFit.Eval(-peakFit.GetParameter(1) / (2 * peakFit.GetParameter(2)));
200  if (ped != max) {
201  PN_amp[j] = PN_amp[j] + max - ped;
202  } else {
203  PN_amp[j] = PN_amp[j] + max;
204  }
205 
206  } //end of z loop
207  PN_amp[j] = PN_amp[j] / 2.0;
208  } //end of j loop
209 
210  //do some real PN, APD calculations
211 
212  //FIXME. previously used .info files to get time, what to do now?
213 
214  // TNtuple *Time = new TNtuple("Time", "Time", "Time");
215  // Int_t iTime = Get_Time(Input_File);
216  // Time->Fill(iTime);
217 
218  Float_t fTree[7];
219 
220  // b->GetEntry(EVT);
221  EBDetId ID;
222  Float_t theAPD;
223  Float_t thePN;
224  Float_t Jitter;
225  Float_t Chi2;
226  Int_t CN = hits->size();
227  // cout<<"num CN: "<<CN<<endl;
228  for (int j = 0; j < CN; j++) {
229  ID = (*hits)[j].id();
230  theAPD = (*hits)[j].amplitude();
231  Jitter = (*hits)[j].jitter();
232  Chi2 = (*hits)[j].chi2();
233  thePN = PN_amp[(ID.ic() + 299) / 400];
234 
235  // cout<<"THE APD: "<<theAPD<<endl;
236  // cout<<"THE PN: "<<thePN<<endl;
237 
238  C_APD[ID.ic() - 1]->Fill(theAPD);
239  C_APDPN[ID.ic() - 1]->Fill(theAPD / thePN);
240  C_PN[ID.ic() - 1]->Fill(thePN);
241  C_J[ID.ic() - 1]->Fill(Jitter);
242  C_APDPN_J[ID.ic() - 1]->Fill(Jitter, theAPD / thePN);
243  APDPN_J->Fill(Jitter, theAPD / thePN);
244  APDPN_C->Fill(Chi2, theAPD / thePN);
245  fTree[0] = theAPD;
246  fTree[1] = thePN;
247  fTree[2] = theAPD / thePN;
248  fTree[3] = Jitter;
249  fTree[4] = Chi2;
250  fTree[5] = (*hits)[j].pedestal();
251  fTree[6] = iEvent.id().event();
252  C_Tree[ID.ic() - 1]->Fill(fTree);
253  if (((ID.ic() - 1) % 20 > 9) || ((ID.ic() - 1) < 100)) {
254  peakAPD[0]->Fill(theAPD);
255  peakAPDPN[0]->Fill(theAPD / thePN);
256  APDPN_J_H[0]->Fill(Jitter, theAPD / thePN);
257  } else {
258  peakAPD[1]->Fill(theAPD);
259  peakAPDPN[1]->Fill(theAPD / thePN);
260  APDPN_J_H[1]->Fill(Jitter, theAPD / thePN);
261  }
262  if ((ID.ic() - 1) < 100) {
263  APD_LM[0]->Fill(theAPD);
264  APDPN_LM[0]->Fill(theAPD / thePN);
265  APDPN_J_LM[0]->Fill(Jitter, theAPD / thePN);
266  } else {
267  Int_t index;
268  if (((ID.ic() - 1) % 20) < 10) {
269  index = ((ID.ic() - 101) / 400) * 2 + 1;
270  APD_LM[index]->Fill(theAPD);
271  APDPN_LM[index]->Fill(theAPD / thePN);
272  APDPN_J_LM[index]->Fill(Jitter, theAPD / thePN);
273  } else {
274  index = ((ID.ic() - 101) / 400) * 2 + 2;
275  APD_LM[index]->Fill(theAPD);
276  APDPN_LM[index]->Fill(theAPD / thePN);
277  APDPN_J_LM[index]->Fill(Jitter, theAPD / thePN);
278  }
279  }
280  } //end of CN loop
281 
282  //now that you got the PN and APD's, make the ntuples. done
283 
284  //vec from ROOT version should correspond to hits_itr or something similar. done
285 
286  //check WL from PNdiodedigi, should be ==0, o.w (blue data only). don't process. done
287 
288  //get PN pulse, and do fitting of pulse. i.e. fill hist with PN.apd() or equivalent. done
289 
290  //fit to first 5 for PED, and 30-50 bins for pulse (poly2 for the moment). done
291 }
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDigiToken_
uint32_t ID
Definition: Definitions.h:24
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
const_iterator begin() const
const std::string hitCollection_
const edm::EDGetTokenT< EBUncalibratedRecHitCollection > hitToken_
bool isValid() const
Definition: HandleBase.h:70
static const float CN[]
Definition: sicif.h:75
HLT enums.
Definition: Chi2.h:15
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ beginJob()

void EcalLaserAnalyzerYousi::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 294 of file EcalLaserAnalyzerYousi.cc.

References APD, APD_LM, APD_RMS, APDPN, APDPN_C, APDPN_J, APDPN_J_H, APDPN_J_LM, APDPN_LM, APDPN_RMS, C_APD, C_APDPN, C_APDPN_J, C_J, C_PN, C_Tree, Count, FitHist, fROOT, mps_fire::i, Skims_PA_cff::name, outFileName_, peakAPD, peakAPDPN, and PN.

294  {
295  edm::LogInfo("EcalLaserAnalyzerYousi") << "running laser analyzer \n\n";
296 
297  fROOT = new TFile(outFileName_.c_str(), "RECREATE");
298  fROOT->cd();
299 
300  //init all the histos and files?
301  APD = new TH2F("APD", "APD", 85, 0., 85., 20, 0., 20.);
302  APD_RMS = new TH2F("APD_RMS", "APD_RMS", 85, 0., 85., 20, 0., 20.);
303  APDPN = new TH2F("APDPN", "APDPN", 85, 0., 85., 20, 0., 20.);
304  APDPN_RMS = new TH2F("APDPN_RMS", "APDPN_RMS", 85, 0., 85., 20, 0., 20.);
305  PN = new TH2F("PN", "PN", 85, 0., 85., 20, 0., 20.);
306  APDPN_J = new TH2F("JittervAPDPN", "JittervAPDPN", 250, 3., 7., 250, 1., 2.);
307  APDPN_C = new TH2F("Chi2vAPDPN", "Chi2vAPDPN", 250, 0., 50., 250, 0., 5.0);
308  FitHist = new TH1F("FitHist", "FitHist", 50, 0, 50);
309  Count = new TH2F("Count", "Count", 85, 0., 1., 20, 0., 1.);
310 
311  for (int i = 0; i < 1700; i++) {
312  std::ostringstream name_1;
313  std::ostringstream name_2;
314  std::ostringstream name_3;
315  std::ostringstream name_4;
316  std::ostringstream name_5;
317  name_1 << "C_APD_" << i + 1;
318  name_2 << "C_APDPN_" << i + 1;
319  name_3 << "C_PN_" << i + 1;
320  name_4 << "C_J_" << i + 1;
321  name_5 << "C_APDPN_J_" << i + 1;
322  C_APD[i] = new TH1F(name_1.str().c_str(), name_1.str().c_str(), 2500, 0., 5000.);
323  C_APDPN[i] = new TH1F(name_2.str().c_str(), name_2.str().c_str(), 20000, 0., 25.);
324  C_PN[i] = new TH1F(name_3.str().c_str(), name_3.str().c_str(), 1000, 0., 4000.);
325  C_J[i] = new TH1F(name_4.str().c_str(), name_4.str().c_str(), 250, 3.0, 7.);
326  C_APDPN_J[i] = new TH2F(name_5.str().c_str(), name_5.str().c_str(), 250, 3.0, 6., 250, 1., 2.2);
327  }
328 
329  for (int i = 0; i < 2; i++) {
330  std::ostringstream aname_1;
331  std::ostringstream aname_2;
332  std::ostringstream aname_3;
333  aname_1 << "peakAPD_" << i;
334  aname_2 << "peakAPDPN_" << i;
335  aname_3 << "JittervAPDPN_Half_" << i;
336  peakAPD[i] = new TH1F(aname_1.str().c_str(), aname_1.str().c_str(), 1000, 0., 5000.);
337  peakAPDPN[i] = new TH1F(aname_2.str().c_str(), aname_2.str().c_str(), 1000, 0., 8.);
338  APDPN_J_H[i] = new TH2F(aname_3.str().c_str(), aname_3.str().c_str(), 250, 3., 7., 250, 1., 2.2);
339  }
340 
341  for (int i = 0; i < 9; i++) {
342  std::ostringstream bname_1;
343  std::ostringstream bname_2;
344  std::ostringstream bname_3;
345  bname_1 << "APD_LM_" << i;
346  bname_2 << "APDPN_LM_" << i;
347  bname_3 << "APDPN_J_LM_" << i;
348  APD_LM[i] = new TH1F(bname_1.str().c_str(), bname_1.str().c_str(), 500, 0., 5000.);
349  APDPN_LM[i] = new TH1F(bname_2.str().c_str(), bname_2.str().c_str(), 500, 0., 8.);
350  APDPN_J_LM[i] = new TH2F(bname_3.str().c_str(), bname_3.str().c_str(), 250, 3., 7., 250, 1., 2.2);
351  }
352 
353  //get the PN file. or don't get, and read from event.
354 
355  //don't need to get AB, it will be read in via framework poolsource = ???
356 
357  //configure the final NTuple
358  std::ostringstream varlist;
359  varlist << "APD:PN:APDPN:Jitter:Chi2:ped:EVT";
360  for (int i = 0; i < 1700; i++) {
361  std::ostringstream name;
362  name << "C_Tree_" << i + 1;
363  C_Tree[i] = (TNtuple *)new TNtuple(name.str().c_str(), name.str().c_str(), varlist.str().c_str());
364  }
365 }
Log< level::Info, false > LogInfo

◆ endJob()

void EcalLaserAnalyzerYousi::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 368 of file EcalLaserAnalyzerYousi.cc.

References APD, APD_LM, APD_RMS, APDPN, APDPN_C, APDPN_J, APDPN_J_H, APDPN_J_LM, APDPN_LM, APDPN_RMS, C_APD, C_APDPN, C_APDPN_J, C_J, C_PN, C_Tree, dqmPostProcessing_online::DIR, fROOT, mps_fire::i, dqmiolumiharvest::j, outFileName_, peakAPD, peakAPDPN, PN, RMS, and Run_.

Referenced by o2olib.O2ORunMgr::executeJob().

368  {
369  //write the file (get ouput file name first).
370  TFile *fROOT = (TFile *)new TFile(outFileName_.c_str(), "RECREATE");
371 
372  // TDirectory *DIR = fROOT->Get(Run_.c_str());
373  TDirectory *DIR;
374  // if(DIR == NULL){
375  DIR = fROOT->mkdir(Run_.c_str());
376  // }
377  DIR->cd();
378  for (int j = 0; j < 1700; j++) {
379  Float_t min_r, max_r;
380  Float_t RMS, Sigma, K;
381  Int_t iCount;
382  TF1 *gs3;
383 
384  RMS = C_APD[j]->GetRMS();
385  APD_RMS->SetBinContent(85 - (j / 20), 20 - (j % 20), RMS);
386  Sigma = 999999;
387  K = 2.5;
388  iCount = 0;
389  while (Sigma > RMS) {
390  min_r = C_APD[j]->GetBinCenter(C_APD[j]->GetMaximumBin()) - K * RMS;
391  max_r = C_APD[j]->GetBinCenter(C_APD[j]->GetMaximumBin()) + K * RMS;
392  TF1 gs1("gs1", "gaus", min_r, max_r);
393  C_APD[j]->Fit(&gs1, "RQI");
394  Sigma = gs1.GetParameter(2);
395  K = K * 1.5;
396  iCount++;
397  if (iCount > 2) {
398  C_APD[j]->Fit("gaus", "QI");
399  break;
400  }
401  }
402 
403  RMS = C_APDPN[j]->GetRMS();
404  APDPN_RMS->SetBinContent(85 - (j / 20), 20 - (j % 20), RMS);
405  Sigma = 999999;
406  K = 2.5;
407  iCount = 0;
408  while (Sigma > RMS) {
409  min_r = C_APDPN[j]->GetBinCenter(C_APDPN[j]->GetMaximumBin()) - K * RMS;
410  max_r = C_APDPN[j]->GetBinCenter(C_APDPN[j]->GetMaximumBin()) + K * RMS;
411  TF1 gs2("gs2", "gaus", min_r, max_r);
412  C_APDPN[j]->Fit(&gs2, "RQI");
413  Sigma = gs2.GetParameter(2);
414  K = K * 1.5;
415  iCount++;
416  if (iCount > 2) {
417  C_APDPN[j]->Fit("gaus", "QI");
418  break;
419  }
420  }
421 
422  TF1 *newgs1;
423  TF1 *newgs2;
424 
425  C_PN[j]->Fit("gaus", "Q");
426  C_APD[j]->Fit("gaus", "QI");
427  C_APDPN[j]->Fit("gaus", "QI");
428  C_APD[j]->Write("", TObject::kOverwrite);
429  C_APDPN[j]->Write("", TObject::kOverwrite);
430  C_PN[j]->Write("", TObject::kOverwrite);
431  C_J[j]->Write("", TObject::kOverwrite);
432  C_APDPN_J[j]->Write("", TObject::kOverwrite);
433  newgs1 = C_APD[j]->GetFunction("gaus");
434  newgs2 = C_APDPN[j]->GetFunction("gaus");
435  gs3 = C_PN[j]->GetFunction("gaus");
436  Float_t theAPD = newgs1->GetParameter(1);
437  APD->SetBinContent(85 - (j / 20), 20 - (j % 20), theAPD);
438  Float_t theAPDPN = newgs2->GetParameter(1);
439  APDPN->SetBinContent(85 - (j / 20), 20 - (j % 20), theAPDPN);
440  Float_t thePN = gs3->GetParameter(1);
441  // cout<<"LOOK HERE thePN = "<< thePN<<endl;
442  PN->SetBinContent(85 - (j / 20), 20 - (j % 20), thePN);
443  C_Tree[j]->Write("", TObject::kOverwrite);
444  }
445 
446  for (int i = 0; i < 9; i++) {
447  APD_LM[i]->Write("", TObject::kOverwrite);
448  APDPN_LM[i]->Write("", TObject::kOverwrite);
449  APDPN_J_LM[i]->Write("", TObject::kOverwrite);
450  }
451 
452  // Time->Write("", TObject::kOverwrite);
453  APD->Write("", TObject::kOverwrite);
454  APD_RMS->Write("", TObject::kOverwrite);
455  APDPN_RMS->Write("", TObject::kOverwrite);
456  APDPN->Write("", TObject::kOverwrite);
457  APDPN_J->Write("", TObject::kOverwrite);
458  APDPN_C->Write("", TObject::kOverwrite);
459  PN->Write("", TObject::kOverwrite);
460  peakAPD[0]->Write("", TObject::kOverwrite);
461  peakAPD[1]->Write("", TObject::kOverwrite);
462  peakAPDPN[0]->Write("", TObject::kOverwrite);
463  peakAPDPN[1]->Write("", TObject::kOverwrite);
464  APDPN_J_H[0]->Write("", TObject::kOverwrite);
465  APDPN_J_H[1]->Write("", TObject::kOverwrite);
466 
467  // don't Make plots
468  // fROOT->Close();
469 
470  // fPN->Close();
471  // fAPD->Close();
472 
473  fROOT->Write();
474  // fROOT->Close();
475 }

Member Data Documentation

◆ APD

TH2F* EcalLaserAnalyzerYousi::APD
private

Definition at line 78 of file EcalLaserAnalyzerYousi.cc.

Referenced by beginJob(), and endJob().

◆ APD_LM

TH1F* EcalLaserAnalyzerYousi::APD_LM[9]
private

Definition at line 72 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ APD_RMS

TH2F* EcalLaserAnalyzerYousi::APD_RMS
private

Definition at line 79 of file EcalLaserAnalyzerYousi.cc.

Referenced by beginJob(), and endJob().

◆ APDPN

TH2F* EcalLaserAnalyzerYousi::APDPN
private

Definition at line 80 of file EcalLaserAnalyzerYousi.cc.

Referenced by beginJob(), and endJob().

◆ APDPN_C

TH2F* EcalLaserAnalyzerYousi::APDPN_C
private

Definition at line 84 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ APDPN_J

TH2F* EcalLaserAnalyzerYousi::APDPN_J
private

Definition at line 83 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ APDPN_J_H

TH2F* EcalLaserAnalyzerYousi::APDPN_J_H[2]
private

Definition at line 75 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ APDPN_J_LM

TH2F* EcalLaserAnalyzerYousi::APDPN_J_LM[9]
private

Definition at line 74 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ APDPN_LM

TH1F* EcalLaserAnalyzerYousi::APDPN_LM[9]
private

Definition at line 73 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ APDPN_RMS

TH2F* EcalLaserAnalyzerYousi::APDPN_RMS
private

Definition at line 81 of file EcalLaserAnalyzerYousi.cc.

Referenced by beginJob(), and endJob().

◆ C_APD

TH1F* EcalLaserAnalyzerYousi::C_APD[1700]
private

Definition at line 64 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ C_APDPN

TH1F* EcalLaserAnalyzerYousi::C_APDPN[1700]
private

Definition at line 65 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ C_APDPN_J

TH2F* EcalLaserAnalyzerYousi::C_APDPN_J[1700]
private

Definition at line 68 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ C_J

TH1F* EcalLaserAnalyzerYousi::C_J[1700]
private

Definition at line 67 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ C_PN

TH1F* EcalLaserAnalyzerYousi::C_PN[1700]
private

Definition at line 66 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ C_Tree

TNtuple* EcalLaserAnalyzerYousi::C_Tree[1700]
private

Definition at line 93 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ Count

TH2F* EcalLaserAnalyzerYousi::Count
private

Definition at line 87 of file EcalLaserAnalyzerYousi.cc.

Referenced by beginJob().

◆ digiProducer_

const std::string EcalLaserAnalyzerYousi::digiProducer_
private

Definition at line 104 of file EcalLaserAnalyzerYousi.cc.

◆ fAPD

TFile* EcalLaserAnalyzerYousi::fAPD
private

Definition at line 90 of file EcalLaserAnalyzerYousi.cc.

◆ FitHist

TH1F* EcalLaserAnalyzerYousi::FitHist
private

Definition at line 86 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), and beginJob().

◆ fPN

TFile* EcalLaserAnalyzerYousi::fPN
private

Definition at line 89 of file EcalLaserAnalyzerYousi.cc.

◆ fROOT

TFile* EcalLaserAnalyzerYousi::fROOT
private

Definition at line 91 of file EcalLaserAnalyzerYousi.cc.

Referenced by beginJob(), and endJob().

◆ hitCollection_

const std::string EcalLaserAnalyzerYousi::hitCollection_
private

Definition at line 97 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze().

◆ hitProducer_

const std::string EcalLaserAnalyzerYousi::hitProducer_
private

Definition at line 98 of file EcalLaserAnalyzerYousi.cc.

◆ hitToken_

const edm::EDGetTokenT<EBUncalibratedRecHitCollection> EcalLaserAnalyzerYousi::hitToken_
private

Definition at line 107 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze().

◆ outFileName_

const std::string EcalLaserAnalyzerYousi::outFileName_
private

Definition at line 101 of file EcalLaserAnalyzerYousi.cc.

Referenced by beginJob(), and endJob().

◆ peakAPD

TH1F* EcalLaserAnalyzerYousi::peakAPD[2]
private

Definition at line 70 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ peakAPDPN

TH1F* EcalLaserAnalyzerYousi::peakAPDPN[2]
private

Definition at line 71 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze(), beginJob(), and endJob().

◆ PN

TH2F* EcalLaserAnalyzerYousi::PN
private

Definition at line 82 of file EcalLaserAnalyzerYousi.cc.

Referenced by beginJob(), and endJob().

◆ PNdigiCollection_

const std::string EcalLaserAnalyzerYousi::PNdigiCollection_
private

Definition at line 105 of file EcalLaserAnalyzerYousi.cc.

◆ pnDigiToken_

const edm::EDGetTokenT<EcalPnDiodeDigiCollection> EcalLaserAnalyzerYousi::pnDigiToken_
private

Definition at line 108 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze().

◆ rawDataToken_

const edm::EDGetTokenT<EcalRawDataCollection> EcalLaserAnalyzerYousi::rawDataToken_
private

Definition at line 106 of file EcalLaserAnalyzerYousi.cc.

Referenced by analyze().

◆ Run_

const std::string EcalLaserAnalyzerYousi::Run_
private

Definition at line 103 of file EcalLaserAnalyzerYousi.cc.

Referenced by endJob().

◆ SM_

const std::string EcalLaserAnalyzerYousi::SM_
private

Definition at line 102 of file EcalLaserAnalyzerYousi.cc.