ATLAS Offline Software
Loading...
Searching...
No Matches
TCck Class Reference
Collaboration diagram for TCck:

Public Member Functions

 TCck (TDirectory *d, int depth=0)
 ~TCck ()
std::vector< inodescan (int depth=0)

Protected Member Functions

void pscan (int depth=0)

Protected Attributes

TDirectory * m_dir
std::vector< inodem_nodes
int m_depth

Static Protected Attributes

static std::string spacer = ""

Detailed Description

Definition at line 204 of file listroot.cxx.

Constructor & Destructor Documentation

◆ TCck()

TCck::TCck ( TDirectory * d,
int depth = 0 )
inline

Definition at line 208 of file listroot.cxx.

208: m_dir(d), m_depth(depth) { }
TDirectory * m_dir
Definition listroot.cxx:400
int m_depth
Definition listroot.cxx:403
std::string depth
tag string for intendation
Definition fastadd.cxx:46

◆ ~TCck()

TCck::~TCck ( )
inline

Definition at line 212 of file listroot.cxx.

212{ }

Member Function Documentation

◆ pscan()

void TCck::pscan ( int depth = 0)
inlineprotected

Definition at line 221 of file listroot.cxx.

221 {
222
223 if ( depth>maxdepth ) return;
224
225 std::string inspace = spacer;
226
227 TDirectory* cck = gDirectory;
228
229 int deptht = depth-1;
230
231 bool accept = true;
232
233
234 // std::cout << "GOLLY! " << m_dir->GetName() << "\tdepth " << depth << " " << deptht << "\tsize " << directories.size() << " " << directories << std::endl;
235
236
237 if ( directories.size()>size_t(0) ) {
238 if ( deptht>=0 && size_t(deptht)<directories.size() ) {
239 // std::cout << "directory[" << deptht << "] = " << directories[deptht] << " " << std::string(_dir->GetName()) << std::endl;
240 if ( directories[deptht]!=std::string(m_dir->GetName() ) &&
241 !( // contains( m_dir->GetName(), "SMK_" ) &&
242 contains( m_dir->GetName(), directories[deptht] ) ) ) accept = false;
243 }
244 }
245
246 // std::cout << "accept " << accept << std::endl;
247
248
249 if ( !accept ) return;
250
251 // std::cout << spacer << m_dir->GetName() << "\tdepth " << _depth << std::endl;
252
253 spacer += "\t";
254
255
256 m_dir->cd();
257
258
259 TList* tl = m_dir->GetListOfKeys();
260
261
262 for ( int i=tl->GetSize() ; i-- ; ) {
263
264 TKey* tobj = (TKey*)tl->At(i);
265 if ( tobj ) {
266 TDirectory* tnd = 0;
267 std::vector<inode> nodes;
268
269 // if ( depth>1 ) continue;
270
271 // std::cout << "(" << depth << ")\t" << spacer << tobj->GetName() << "\t: " << tobj->GetClassName() << std::endl;
272
273 if ( std::string(tobj->GetClassName()).find("TDirectory")!=std::string::npos ) {
274 tnd = (TDirectory*)tobj->ReadObj();
275 nodes = TCck( tnd, depth+1 ).scan( depth+1 );
276 m_nodes.push_back( inode( tobj->GetName(), tobj->GetClassName(), tobj, tnd, nodes ) );
277 }
278 else {
279
280 bool accept = false;
281
282 if ( patterns.empty() ) accept = true;
283 else {
284 for ( unsigned ip=patterns.size() ; ip-- ; ) {
285 if ( std::string( tobj->GetName()).find( patterns[ip] )!=std::string::npos ) accept = true;
286 // if ( accept ) std::cout << "match " << patterns[ip] << std::endl;
287 }
288 }
289
290 for ( unsigned ip=Patterns.size() ; ip-- ; ) {
291 if ( std::string( tobj->GetName()).find( Patterns[ip] )==std::string::npos ) accept = false;
292 // if ( accept ) std::cout << "match " << Patterns[ip] << std::endl;
293 }
294
295 if ( accept && isvetoed(tobj->GetName()) ) accept = false;
296
297 if ( accept ) {
298 m_nodes.push_back( inode( tobj->GetName(), tobj->GetClassName(), tobj ) );
299
300
301 // bool display = true;
302
303 std::cout << "(" << depth << ")\t" << spacer << m_nodes.back(); // << " " << tobj->GetName();
304
305 if ( std::string( tobj->GetClassName()).find("TH1")!=std::string::npos ) {
306 TH1* h = (TH1*)tobj->ReadObj();
307 h->SetDirectory(0);
308
309 if ( entries!=0 && h->GetEntries()>entries ) {
310 std::cout << "\tentries " << h->GetEntries() << " \tmean " << h->GetMean() << "\tplot " << plot << "\t"; // << std::endl;
311 }
312
313
314 if ( plot ) {
315 // std::cout << "plotting " << tobj->GetName() << "\tmean " << h->GetMean() << "\tentries " << h->GetEntries() << "\tis vetoed" << isvetoed( tobj->GetName() ) << std::endl;
316 if ( h->GetMean()>=minmean && h->GetMean()<=maxmean ) {
317 // std::cout << "plotting " << tobj->GetName() << "\tmean " << h->GetMean() << std::endl;
318 std::cout << "plotting min " << minmean << "\tmax " << maxmean; // << tobj->GetName() << "\tmean " << h->GetMean() << std::endl;
319 h->SetMaximum( hmax(h)*1.2 );
320
321 std::string t = tobj->GetName();
322
323 if ( t.find("____")!=std::string::npos ) t.erase( 0, t.find("___")+4);
324 if ( t.find("_FirstTime")!=std::string::npos ) t.erase( t.find("_FirstTime"), t.size());
325
326 h->SetTitle(t.c_str());
327
328 if ( logy ) minlog( h );
329
330 h->SetLineColor( colours[istyle%4] );
331 h->SetLineStyle( styles[(istyle/4)%4] );
332
333 if ( binwidth ) binWidth( h );
334
335 if ( !drawn || !overlay ) {
336 if ( xmax!=xmin ) h->GetXaxis()->SetRangeUser( xmin, xmax );
337 if ( ymax!=ymin ) {
338 h->SetMaximum( ymax );
339 if ( logy && ymin!=0 ) h->SetMinimum( ymin );
340 }
341 h->DrawCopy("hist");
342 }
343
344 h->DrawCopy("samehist");
345
346
347 if ( drawmean ) DrawLabel( 0.5, 0.8-istyle*0.05, label("mean = %5.2lf #pm %5.2lf ms", h->GetMean(), h->GetMeanError() ), colours[istyle%4] );
348
349 if ( logy ) gPad->SetLogy(true);
350 gPad->Print( (std::string(tobj->GetName())+".pdf").c_str() );
351
352
353 if ( overlay ) istyle++;
354
355 drawn = true;
356 }
357 }
358
359 std::cout << std::endl;
360
361 // else std::cout << std::endl;
362
363 if ( fout ) {
364 std::string cckname = tobj->GetName();
365 TDirectory* cck = gDirectory;
366 fout->cd();
367
368 std::string tdir = chop( cckname, "____" );
369
370 if ( cckname.size()==0 ) {
371 h->SetName( tdir.c_str() );
372 h->Write();
373 }
374 else {
375 TIDDirectory dcck(tdir);
376 dcck.push();
377
378 h->SetName( cckname.c_str() );
379 h->Write();
380 dcck.pop();
381 }
382 cck->cd();
383 }
384 }
385 else {
386 std::cout << std::endl;
387 }
388 }
389 }
390 }
391 }
392
393 if ( cck ) cck->cd();
394
395 spacer = std::move(inspace);
396 }
int DrawLabel(float xstart, float ystart, string label)
static std::string spacer
Definition listroot.cxx:405
std::vector< inode > m_nodes
Definition listroot.cxx:401
TCck(TDirectory *d, int depth=0)
Definition listroot.cxx:208
std::string chop(std::string &s1, const std::string &s2)
Definition hcg.cxx:161
std::string label(const std::string &format, int i)
Definition label.h:19
double minmean
these patterns are vetoed
Definition listroot.cxx:193
double xmax
Definition listroot.cxx:61
std::vector< std::string > directories
Definition listroot.cxx:185
std::vector< std::string > Patterns
these patterns are ored
Definition listroot.cxx:189
bool logy
Definition listroot.cxx:45
int istyle
Definition listroot.cxx:54
int colours[4]
Definition listroot.cxx:51
double maxmean
Definition listroot.cxx:194
void binWidth(TH1 *h)
Definition listroot.cxx:80
bool contains(const std::string &s, const std::string &regex)
does a string contain the substring
Definition listroot.cxx:67
bool isvetoed(const std::string &s)
Definition listroot.cxx:196
bool overlay
Definition listroot.cxx:42
bool drawmean
Definition listroot.cxx:47
double ymin
Definition listroot.cxx:63
bool drawn
Definition listroot.cxx:56
bool plot
Definition listroot.cxx:44
double entries
Definition listroot.cxx:49
static TFile * fout
Definition listroot.cxx:40
int maxdepth
Definition listroot.cxx:202
double xmin
Definition listroot.cxx:60
bool binwidth
Definition listroot.cxx:58
double hmax(TH1 *&h)
Definition listroot.cxx:115
int styles[4]
Definition listroot.cxx:52
std::vector< std::string > patterns
Definition listroot.cxx:187
void minlog(TH1 *h)
Definition listroot.cxx:94
double ymax
Definition listroot.cxx:64
StatusCode accept(const xAOD::Muon *mu)

◆ scan()

std::vector< inode > TCck::scan ( int depth = 0)
inline

Definition at line 214 of file listroot.cxx.

214 {
215 if ( m_nodes.size()==0 ) pscan(depth);
216 return m_nodes;
217 }
void pscan(int depth=0)
Definition listroot.cxx:221

Member Data Documentation

◆ m_depth

int TCck::m_depth
protected

Definition at line 403 of file listroot.cxx.

◆ m_dir

TDirectory* TCck::m_dir
protected

Definition at line 400 of file listroot.cxx.

◆ m_nodes

std::vector<inode> TCck::m_nodes
protected

Definition at line 401 of file listroot.cxx.

◆ spacer

std::string TCck::spacer = ""
staticprotected

Definition at line 405 of file listroot.cxx.


The documentation for this class was generated from the following file: